Merge "Dumping stack traces to proto." into pi-dev
diff --git a/api/system-current.txt b/api/system-current.txt
index 0555263..6eef3a2 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -2115,8 +2115,15 @@
field public static final java.lang.String METADATA_KEY_ART = "android.hardware.radio.metadata.ART";
field public static final java.lang.String METADATA_KEY_ARTIST = "android.hardware.radio.metadata.ARTIST";
field public static final java.lang.String METADATA_KEY_CLOCK = "android.hardware.radio.metadata.CLOCK";
+ field public static final java.lang.String METADATA_KEY_DAB_COMPONENT_NAME = "android.hardware.radio.metadata.DAB_COMPONENT_NAME";
+ field public static final java.lang.String METADATA_KEY_DAB_COMPONENT_NAME_SHORT = "android.hardware.radio.metadata.DAB_COMPONENT_NAME_SHORT";
+ field public static final java.lang.String METADATA_KEY_DAB_ENSEMBLE_NAME = "android.hardware.radio.metadata.DAB_ENSEMBLE_NAME";
+ field public static final java.lang.String METADATA_KEY_DAB_ENSEMBLE_NAME_SHORT = "android.hardware.radio.metadata.DAB_ENSEMBLE_NAME_SHORT";
+ field public static final java.lang.String METADATA_KEY_DAB_SERVICE_NAME = "android.hardware.radio.metadata.DAB_SERVICE_NAME";
+ field public static final java.lang.String METADATA_KEY_DAB_SERVICE_NAME_SHORT = "android.hardware.radio.metadata.DAB_SERVICE_NAME_SHORT";
field public static final java.lang.String METADATA_KEY_GENRE = "android.hardware.radio.metadata.GENRE";
field public static final java.lang.String METADATA_KEY_ICON = "android.hardware.radio.metadata.ICON";
+ field public static final java.lang.String METADATA_KEY_PROGRAM_NAME = "android.hardware.radio.metadata.PROGRAM_NAME";
field public static final java.lang.String METADATA_KEY_RBDS_PTY = "android.hardware.radio.metadata.RBDS_PTY";
field public static final java.lang.String METADATA_KEY_RDS_PI = "android.hardware.radio.metadata.RDS_PI";
field public static final java.lang.String METADATA_KEY_RDS_PS = "android.hardware.radio.metadata.RDS_PS";
diff --git a/cmds/statsd/Android.mk b/cmds/statsd/Android.mk
index 8ecb538..605198f 100644
--- a/cmds/statsd/Android.mk
+++ b/cmds/statsd/Android.mk
@@ -40,10 +40,6 @@
src/external/SubsystemSleepStatePuller.cpp \
src/external/ResourceHealthManagerPuller.cpp \
src/external/ResourceThermalManagerPuller.cpp \
- src/external/CpuTimePerUidPuller.cpp \
- src/external/CpuTimePerUidFreqPuller.cpp \
- src/external/KernelUidCpuActiveTimeReader.cpp \
- src/external/KernelUidCpuClusterTimeReader.cpp \
src/external/StatsPullerManagerImpl.cpp \
src/external/puller_util.cpp \
src/logd/LogEvent.cpp \
diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto
index fa96e11..9bfbd38 100644
--- a/cmds/statsd/src/atoms.proto
+++ b/cmds/statsd/src/atoms.proto
@@ -1489,7 +1489,7 @@
* Note that isolated process uid time should be attributed to host uids.
*/
message CpuTimePerUid {
- optional uint64 uid = 1;
+ optional int32 uid = 1;
optional uint64 user_time_millis = 2;
optional uint64 sys_time_millis = 3;
}
@@ -1500,8 +1500,8 @@
* For each uid, we order the time by descending frequencies.
*/
message CpuTimePerUidFreq {
- optional uint64 uid = 1;
- optional uint64 freq_idx = 2;
+ optional int32 uid = 1;
+ optional uint32 freq_index = 2;
optional uint64 time_millis = 3;
}
@@ -1634,10 +1634,8 @@
* The file contains a monotonically increasing count of time for a single boot.
*/
message CpuActiveTime {
- optional uint64 uid = 1;
- optional uint32 cluster_number = 2;
- optional uint64 idx = 3;
- optional uint64 time_millis = 4;
+ optional int32 uid = 1;
+ optional uint64 time_millis = 2;
}
/**
@@ -1650,8 +1648,8 @@
* The file contains a monotonically increasing count of time for a single boot.
*/
message CpuClusterTime {
- optional uint64 uid = 1;
- optional uint64 idx = 2;
+ optional int32 uid = 1;
+ optional int32 cluster_index = 2;
optional uint64 time_millis = 3;
}
diff --git a/cmds/statsd/src/external/CpuTimePerUidFreqPuller.cpp b/cmds/statsd/src/external/CpuTimePerUidFreqPuller.cpp
deleted file mode 100644
index d1d9d37..0000000
--- a/cmds/statsd/src/external/CpuTimePerUidFreqPuller.cpp
+++ /dev/null
@@ -1,100 +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.
- */
-
-#define DEBUG false // STOPSHIP if true
-#include "Log.h"
-
-#include <fstream>
-#include "external/CpuTimePerUidFreqPuller.h"
-
-#include "../guardrail/StatsdStats.h"
-#include "CpuTimePerUidFreqPuller.h"
-#include "guardrail/StatsdStats.h"
-#include "logd/LogEvent.h"
-#include "statslog.h"
-#include "stats_log_util.h"
-
-using std::make_shared;
-using std::shared_ptr;
-using std::ifstream;
-
-namespace android {
-namespace os {
-namespace statsd {
-
-static const string sProcFile = "/proc/uid_time_in_state";
-static const int kLineBufferSize = 1024;
-
-/**
- * Reads /proc/uid_time_in_state which has the format:
- *
- * uid: [freq1] [freq2] [freq3] ...
- * [uid1]: [time in freq1] [time in freq2] [time in freq3] ...
- * [uid2]: [time in freq1] [time in freq2] [time in freq3] ...
- * ...
- *
- * This provides the times a UID's processes spent executing at each different cpu frequency.
- * The file contains a monotonically increasing count of time for a single boot.
- */
-CpuTimePerUidFreqPuller::CpuTimePerUidFreqPuller()
- : StatsPuller(android::util::CPU_TIME_PER_UID_FREQ) {
-}
-
-bool CpuTimePerUidFreqPuller::PullInternal(vector<shared_ptr<LogEvent>>* data) {
- data->clear();
-
- ifstream fin;
- fin.open(sProcFile);
- if (!fin.good()) {
- VLOG("Failed to read pseudo file %s", sProcFile.c_str());
- return false;
- }
-
- int64_t wallClockTimestampNs = getWallClockNs();
- int64_t elapsedTimestampNs = getElapsedRealtimeNs();
-
- char buf[kLineBufferSize];
- // first line prints the format and frequencies
- fin.getline(buf, kLineBufferSize);
- char* pch;
- while (!fin.eof()) {
- fin.getline(buf, kLineBufferSize);
- pch = strtok(buf, " :");
- if (pch == NULL) break;
- uint64_t uid = std::stoull(pch);
- pch = strtok(NULL, " ");
- uint64_t timeMs;
- int idx = 0;
- do {
- timeMs = std::stoull(pch);
- auto ptr = make_shared<LogEvent>(android::util::CPU_TIME_PER_UID_FREQ,
- wallClockTimestampNs, elapsedTimestampNs);
- ptr->write(uid);
- ptr->write(idx);
- ptr->write(timeMs);
- ptr->init();
- data->push_back(ptr);
- VLOG("uid %lld, freq idx %d, sys time %lld", (long long)uid, idx, (long long)timeMs);
- idx++;
- pch = strtok(NULL, " ");
- } while (pch != NULL);
- }
- return true;
-}
-
-} // namespace statsd
-} // namespace os
-} // namespace android
diff --git a/cmds/statsd/src/external/CpuTimePerUidFreqPuller.h b/cmds/statsd/src/external/CpuTimePerUidFreqPuller.h
deleted file mode 100644
index 6f6c669..0000000
--- a/cmds/statsd/src/external/CpuTimePerUidFreqPuller.h
+++ /dev/null
@@ -1,42 +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.
- */
-
-#pragma once
-
-#include <utils/String16.h>
-#include "StatsPuller.h"
-
-namespace android {
-namespace os {
-namespace statsd {
-
-/**
- * Reads /proc/uid_cputime/show_uid_stat which has the line format:
- *
- * uid: user_time_micro_seconds system_time_micro_seconds
- *
- * This provides the time a UID's processes spent executing in user-space and kernel-space.
- * The file contains a monotonically increasing count of time for a single boot.
- */
-class CpuTimePerUidFreqPuller : public StatsPuller {
- public:
- CpuTimePerUidFreqPuller();
- bool PullInternal(vector<std::shared_ptr<LogEvent>>* data) override;
-};
-
-} // namespace statsd
-} // namespace os
-} // namespace android
diff --git a/cmds/statsd/src/external/CpuTimePerUidPuller.cpp b/cmds/statsd/src/external/CpuTimePerUidPuller.cpp
deleted file mode 100644
index 568b8f0..0000000
--- a/cmds/statsd/src/external/CpuTimePerUidPuller.cpp
+++ /dev/null
@@ -1,90 +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.
- */
-
-#define DEBUG false // STOPSHIP if true
-#include "Log.h"
-
-#include <fstream>
-#include "external/CpuTimePerUidPuller.h"
-
-#include "CpuTimePerUidPuller.h"
-#include "guardrail/StatsdStats.h"
-#include "logd/LogEvent.h"
-#include "statslog.h"
-#include "stats_log_util.h"
-
-using std::make_shared;
-using std::shared_ptr;
-using std::ifstream;
-
-namespace android {
-namespace os {
-namespace statsd {
-
-static const string sProcFile = "/proc/uid_cputime/show_uid_stat";
-static const int kLineBufferSize = 1024;
-
-/**
- * Reads /proc/uid_cputime/show_uid_stat which has the line format:
- *
- * uid: user_time_micro_seconds system_time_micro_seconds power_in_milli-amp-micro_seconds
- *
- * This provides the time a UID's processes spent executing in user-space and kernel-space.
- * The file contains a monotonically increasing count of time for a single boot.
- */
-CpuTimePerUidPuller::CpuTimePerUidPuller() : StatsPuller(android::util::CPU_TIME_PER_UID) {
-}
-
-bool CpuTimePerUidPuller::PullInternal(vector<shared_ptr<LogEvent>>* data) {
- data->clear();
-
- ifstream fin;
- fin.open(sProcFile);
- if (!fin.good()) {
- VLOG("Failed to read pseudo file %s", sProcFile.c_str());
- return false;
- }
-
- int64_t wallClockTimestampNs = getWallClockNs();
- int64_t elapsedTimestampNs = getElapsedRealtimeNs();
- char buf[kLineBufferSize];
- char* pch;
- while (!fin.eof()) {
- fin.getline(buf, kLineBufferSize);
- pch = strtok(buf, " :");
- if (pch == NULL) break;
- uint64_t uid = std::stoull(pch);
- pch = strtok(buf, " ");
- uint64_t userTimeMs = std::stoull(pch);
- pch = strtok(buf, " ");
- uint64_t sysTimeMs = std::stoull(pch);
-
- auto ptr = make_shared<LogEvent>(android::util::CPU_TIME_PER_UID,
- wallClockTimestampNs, elapsedTimestampNs);
- ptr->write(uid);
- ptr->write(userTimeMs);
- ptr->write(sysTimeMs);
- ptr->init();
- data->push_back(ptr);
- VLOG("uid %lld, user time %lld, sys time %lld", (long long)uid, (long long)userTimeMs,
- (long long)sysTimeMs);
- }
- return true;
-}
-
-} // namespace statsd
-} // namespace os
-} // namespace android
diff --git a/cmds/statsd/src/external/CpuTimePerUidPuller.h b/cmds/statsd/src/external/CpuTimePerUidPuller.h
deleted file mode 100644
index d0d39d0..0000000
--- a/cmds/statsd/src/external/CpuTimePerUidPuller.h
+++ /dev/null
@@ -1,42 +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.
- */
-
-#pragma once
-
-#include <utils/String16.h>
-#include "StatsPuller.h"
-
-namespace android {
-namespace os {
-namespace statsd {
-
-/**
- * Reads /proc/uid_cputime/show_uid_stat which has the line format:
- *
- * uid: user_time_micro_seconds system_time_micro_seconds
- *
- * This provides the time a UID's processes spent executing in user-space and kernel-space.
- * The file contains a monotonically increasing count of time for a single boot.
- */
-class CpuTimePerUidPuller : public StatsPuller {
- public:
- CpuTimePerUidPuller();
- bool PullInternal(vector<std::shared_ptr<LogEvent>>* data) override;
-};
-
-} // namespace statsd
-} // namespace os
-} // namespace android
diff --git a/cmds/statsd/src/external/KernelUidCpuActiveTimeReader.cpp b/cmds/statsd/src/external/KernelUidCpuActiveTimeReader.cpp
deleted file mode 100644
index 0b545cc..0000000
--- a/cmds/statsd/src/external/KernelUidCpuActiveTimeReader.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * 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.
- */
-
-#define DEBUG false // STOPSHIP if true
-#include "Log.h"
-
-#include <fstream>
-
-#include "KernelUidCpuActiveTimeReader.h"
-#include "guardrail/StatsdStats.h"
-#include "logd/LogEvent.h"
-#include "statslog.h"
-#include "stats_log_util.h"
-
-using std::make_shared;
-using std::shared_ptr;
-using std::ifstream;
-
-namespace android {
-namespace os {
-namespace statsd {
-
-static const string sProcFile = "/proc/uid_concurrent_active_time";
-static const int kLineBufferSize = 1024;
-
-/**
- * Reads /proc/uid_concurrent_active_time which has the format:
- * active: X (X is # cores)
- * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
- * [uid1]: [time-0] [time-1] [time-2] ... ...
- * ...
- * Time-N means the CPU time a UID spent running concurrently with N other processes.
- * The file contains a monotonically increasing count of time for a single boot.
- */
-KernelUidCpuActiveTimeReader::KernelUidCpuActiveTimeReader() : StatsPuller(android::util::CPU_ACTIVE_TIME) {
-}
-
-bool KernelUidCpuActiveTimeReader::PullInternal(vector<shared_ptr<LogEvent>>* data) {
- data->clear();
-
- ifstream fin;
- fin.open(sProcFile);
- if (!fin.good()) {
- VLOG("Failed to read pseudo file %s", sProcFile.c_str());
- return false;
- }
-
- int64_t wallClockTimestampNs = getWallClockNs();
- int64_t elapsedTimestampNs = getElapsedRealtimeNs();
-
- char buf[kLineBufferSize];
- char* pch;
- while (!fin.eof()) {
- fin.getline(buf, kLineBufferSize);
- pch = strtok(buf, " :");
- if (pch == NULL) break;
- uint64_t uid = std::stoull(pch);
- pch = strtok(NULL, " ");
- uint64_t timeMs;
- int idx = 0;
- do {
- timeMs = std::stoull(pch);
- auto ptr = make_shared<LogEvent>(mTagId, wallClockTimestampNs, elapsedTimestampNs);
- ptr->write(uid);
- ptr->write(idx);
- ptr->write(timeMs);
- ptr->init();
- data->push_back(ptr);
- VLOG("uid %lld, freq idx %d, active time %lld", (long long)uid, idx, (long long)timeMs);
- idx++;
- pch = strtok(NULL, " ");
- } while (pch != NULL);
- }
- return true;
-}
-
-} // namespace statsd
-} // namespace os
-} // namespace android
diff --git a/cmds/statsd/src/external/KernelUidCpuActiveTimeReader.h b/cmds/statsd/src/external/KernelUidCpuActiveTimeReader.h
deleted file mode 100644
index fcae35f..0000000
--- a/cmds/statsd/src/external/KernelUidCpuActiveTimeReader.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.
- */
-
-#pragma once
-
-#include <utils/String16.h>
-#include "StatsPuller.h"
-
-namespace android {
-namespace os {
-namespace statsd {
-
-class KernelUidCpuActiveTimeReader : public StatsPuller {
- public:
- KernelUidCpuActiveTimeReader();
- bool PullInternal(vector<std::shared_ptr<LogEvent>>* data) override;
-};
-
-} // namespace statsd
-} // namespace os
-} // namespace android
diff --git a/cmds/statsd/src/external/KernelUidCpuClusterTimeReader.cpp b/cmds/statsd/src/external/KernelUidCpuClusterTimeReader.cpp
deleted file mode 100644
index cc80204..0000000
--- a/cmds/statsd/src/external/KernelUidCpuClusterTimeReader.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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.
- */
-
-#define DEBUG false // STOPSHIP if true
-#include "Log.h"
-
-#include <fstream>
-#include "KernelUidCpuClusterTimeReader.h"
-#include "guardrail/StatsdStats.h"
-#include "logd/LogEvent.h"
-#include "statslog.h"
-#include "stats_log_util.h"
-
-using std::make_shared;
-using std::shared_ptr;
-using std::ifstream;
-
-namespace android {
-namespace os {
-namespace statsd {
-
-static const string sProcFile = "/proc/uid_concurrent_policy_time";
-static const int kLineBufferSize = 1024;
-
-/**
- * Reads /proc/uid_concurrent_policy_time which has the format:
- * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
- * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
- * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
- * ...
- * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
- * The file contains a monotonically increasing count of time for a single boot.
- */
-KernelUidCpuClusterTimeReader::KernelUidCpuClusterTimeReader() : StatsPuller(android::util::CPU_CLUSTER_TIME) {
-}
-
-bool KernelUidCpuClusterTimeReader::PullInternal(vector<shared_ptr<LogEvent>>* data) {
- data->clear();
-
- ifstream fin;
- fin.open(sProcFile);
- if (!fin.good()) {
- VLOG("Failed to read pseudo file %s", sProcFile.c_str());
- return false;
- }
-
- int64_t wallClockTimestampNs = getWallClockNs();
- int64_t elapsedTimestampNs = getElapsedRealtimeNs();
- char buf[kLineBufferSize];
- char* pch;
- while (!fin.eof()) {
- fin.getline(buf, kLineBufferSize);
- pch = strtok(buf, " :");
- if (pch == NULL) break;
- uint64_t uid = std::stoull(pch);
- pch = strtok(NULL, " ");
- uint64_t timeMs;
- int idx = 0;
- do {
- timeMs = std::stoull(pch);
- auto ptr = make_shared<LogEvent>(mTagId, wallClockTimestampNs, elapsedTimestampNs);
- ptr->write(uid);
- ptr->write(idx);
- ptr->write(timeMs);
- ptr->init();
- data->push_back(ptr);
- VLOG("uid %lld, freq idx %d, cluster time %lld", (long long)uid, idx, (long long)timeMs);
- idx++;
- pch = strtok(NULL, " ");
- } while (pch != NULL);
- }
- return true;
-}
-
-} // namespace statsd
-} // namespace os
-} // namespace android
diff --git a/cmds/statsd/src/external/KernelUidCpuClusterTimeReader.h b/cmds/statsd/src/external/KernelUidCpuClusterTimeReader.h
deleted file mode 100644
index 90236ae..0000000
--- a/cmds/statsd/src/external/KernelUidCpuClusterTimeReader.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.
- */
-
-#pragma once
-
-#include <utils/String16.h>
-#include "StatsPuller.h"
-
-namespace android {
-namespace os {
-namespace statsd {
-
-/**
- * Reads /proc/uid_cputime/show_uid_stat which has the line format:
- *
- * uid: user_time_micro_seconds system_time_micro_seconds
- *
- * This provides the time a UID's processes spent executing in user-space and kernel-space.
- * The file contains a monotonically increasing count of time for a single boot.
- */
-class KernelUidCpuClusterTimeReader : public StatsPuller {
- public:
- KernelUidCpuClusterTimeReader();
- bool PullInternal(vector<std::shared_ptr<LogEvent>>* data) override;
-};
-
-} // namespace statsd
-} // namespace os
-} // namespace android
diff --git a/cmds/statsd/src/external/StatsPullerManagerImpl.cpp b/cmds/statsd/src/external/StatsPullerManagerImpl.cpp
index 880dfd1..72a00cb 100644
--- a/cmds/statsd/src/external/StatsPullerManagerImpl.cpp
+++ b/cmds/statsd/src/external/StatsPullerManagerImpl.cpp
@@ -21,10 +21,6 @@
#include <cutils/log.h>
#include <algorithm>
#include <climits>
-#include "CpuTimePerUidFreqPuller.h"
-#include "CpuTimePerUidPuller.h"
-#include "KernelUidCpuActiveTimeReader.h"
-#include "KernelUidCpuClusterTimeReader.h"
#include "ResourceHealthManagerPuller.h"
#include "ResourceThermalManagerPuller.h"
#include "StatsCompanionServicePuller.h"
@@ -51,27 +47,19 @@
const std::map<int, PullAtomInfo> StatsPullerManagerImpl::kAllPullAtomInfo = {
// wifi_bytes_transfer
{android::util::WIFI_BYTES_TRANSFER,
- {{2, 3, 4, 5},
- {},
- 1,
+ {{2, 3, 4, 5}, {}, 1,
new StatsCompanionServicePuller(android::util::WIFI_BYTES_TRANSFER)}},
// wifi_bytes_transfer_by_fg_bg
{android::util::WIFI_BYTES_TRANSFER_BY_FG_BG,
- {{3, 4, 5, 6},
- {2},
- 1,
+ {{3, 4, 5, 6}, {2}, 1,
new StatsCompanionServicePuller(android::util::WIFI_BYTES_TRANSFER_BY_FG_BG)}},
// mobile_bytes_transfer
{android::util::MOBILE_BYTES_TRANSFER,
- {{2, 3, 4, 5},
- {},
- 1,
+ {{2, 3, 4, 5}, {}, 1,
new StatsCompanionServicePuller(android::util::MOBILE_BYTES_TRANSFER)}},
// mobile_bytes_transfer_by_fg_bg
{android::util::MOBILE_BYTES_TRANSFER_BY_FG_BG,
- {{3, 4, 5, 6},
- {2},
- 1,
+ {{3, 4, 5, 6}, {2}, 1,
new StatsCompanionServicePuller(android::util::MOBILE_BYTES_TRANSFER_BY_FG_BG)}},
// bluetooth_bytes_transfer
{android::util::BLUETOOTH_BYTES_TRANSFER,
@@ -80,14 +68,26 @@
{android::util::KERNEL_WAKELOCK,
{{}, {}, 1, new StatsCompanionServicePuller(android::util::KERNEL_WAKELOCK)}},
// subsystem_sleep_state
- {android::util::SUBSYSTEM_SLEEP_STATE, {{}, {}, 1, new SubsystemSleepStatePuller()}},
+ {android::util::SUBSYSTEM_SLEEP_STATE,
+ {{}, {}, 1, new SubsystemSleepStatePuller()}},
// cpu_time_per_freq
{android::util::CPU_TIME_PER_FREQ,
{{3}, {2}, 1, new StatsCompanionServicePuller(android::util::CPU_TIME_PER_FREQ)}},
// cpu_time_per_uid
- {android::util::CPU_TIME_PER_UID, {{2, 3}, {}, 1, new CpuTimePerUidPuller()}},
+ {android::util::CPU_TIME_PER_UID,
+ {{2, 3}, {}, 1, new StatsCompanionServicePuller(android::util::CPU_TIME_PER_UID)}},
// cpu_time_per_uid_freq
- {android::util::CPU_TIME_PER_UID_FREQ, {{3}, {2}, 1, new CpuTimePerUidFreqPuller()}},
+ // the throttling is 3sec, handled in frameworks/base/core/java/com/android/internal/os/KernelCpuProcReader
+ {android::util::CPU_TIME_PER_UID_FREQ,
+ {{4}, {2,3}, 0, new StatsCompanionServicePuller(android::util::CPU_TIME_PER_UID_FREQ)}},
+ // cpu_active_time
+ // the throttling is 3sec, handled in frameworks/base/core/java/com/android/internal/os/KernelCpuProcReader
+ {android::util::CPU_ACTIVE_TIME,
+ {{2}, {}, 0, new StatsCompanionServicePuller(android::util::CPU_ACTIVE_TIME)}},
+ // cpu_cluster_time
+ // the throttling is 3sec, handled in frameworks/base/core/java/com/android/internal/os/KernelCpuProcReader
+ {android::util::CPU_CLUSTER_TIME,
+ {{3}, {2}, 0, new StatsCompanionServicePuller(android::util::CPU_CLUSTER_TIME)}},
// wifi_activity_energy_info
{android::util::WIFI_ACTIVITY_ENERGY_INFO,
{{}, {}, 1, new StatsCompanionServicePuller(android::util::WIFI_ACTIVITY_ENERGY_INFO)}},
@@ -103,10 +103,6 @@
// system_uptime
{android::util::SYSTEM_UPTIME,
{{}, {}, 1, new StatsCompanionServicePuller(android::util::SYSTEM_UPTIME)}},
- // cpu_active_time
- {android::util::CPU_ACTIVE_TIME, {{3}, {2}, 1, new KernelUidCpuActiveTimeReader()}},
- // cpu_cluster_time
- {android::util::CPU_CLUSTER_TIME, {{3}, {2}, 1, new KernelUidCpuClusterTimeReader()}},
// disk_space
{android::util::DISK_SPACE,
{{}, {}, 1, new StatsCompanionServicePuller(android::util::DISK_SPACE)}},
@@ -118,7 +114,10 @@
{{}, {}, 1, new ResourceHealthManagerPuller(android::util::FULL_BATTERY_CAPACITY)}},
// process_memory_state
{android::util::PROCESS_MEMORY_STATE,
- {{4,5,6,7,8}, {2,3}, 0, new StatsCompanionServicePuller(android::util::PROCESS_MEMORY_STATE)}},
+ {{4,5,6,7,8},
+ {2,3},
+ 0,
+ new StatsCompanionServicePuller(android::util::PROCESS_MEMORY_STATE)}},
// temperature
{android::util::TEMPERATURE, {{}, {}, 1, new ResourceThermalManagerPuller()}}};
diff --git a/cmds/statsd/tests/external/puller_util_test.cpp b/cmds/statsd/tests/external/puller_util_test.cpp
index 7d9c8a8..fc6e420 100644
--- a/cmds/statsd/tests/external/puller_util_test.cpp
+++ b/cmds/statsd/tests/external/puller_util_test.cpp
@@ -34,7 +34,7 @@
* Test merge isolated and host uid
*/
-int uidAtomTagId = android::util::CPU_TIME_PER_UID_FREQ;
+int uidAtomTagId = android::util::CPU_CLUSTER_TIME;
int nonUidAtomTagId = android::util::SYSTEM_UPTIME;
int timestamp = 1234;
int isolatedUid = 30;
diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java
index 4a8f61c..efa90d3 100644
--- a/core/java/android/content/pm/ApplicationInfo.java
+++ b/core/java/android/content/pm/ApplicationInfo.java
@@ -763,15 +763,13 @@
public String[] resourceDirs;
/**
- * String retrieved from the seinfo tag found in selinux policy. This value
- * can be overridden with a value set through the mac_permissions.xml policy
- * construct. This value is useful in setting an SELinux security context on
- * the process as well as its data directory. The String default is being used
- * here to represent a catchall label when no policy matches.
+ * String retrieved from the seinfo tag found in selinux policy. This value can be set through
+ * the mac_permissions.xml policy construct. This value is used for setting an SELinux security
+ * context on the process as well as its data directory.
*
* {@hide}
*/
- public String seInfo = "default";
+ public String seInfo;
/**
* The seinfo tag generated per-user. This value may change based upon the
diff --git a/core/java/android/database/sqlite/SQLiteConnection.java b/core/java/android/database/sqlite/SQLiteConnection.java
index 7717b8d..2a791ec 100644
--- a/core/java/android/database/sqlite/SQLiteConnection.java
+++ b/core/java/android/database/sqlite/SQLiteConnection.java
@@ -292,8 +292,10 @@
final boolean walEnabled =
(mConfiguration.openFlags & SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING) != 0;
// Use compatibility WAL unless an app explicitly set journal/synchronous mode
+ // or DISABLE_COMPATIBILITY_WAL flag is set
final boolean useCompatibilityWal = mConfiguration.journalMode == null
- && mConfiguration.syncMode == null && mConfiguration.useCompatibilityWal;
+ && mConfiguration.syncMode == null
+ && (mConfiguration.openFlags & SQLiteDatabase.DISABLE_COMPATIBILITY_WAL) == 0;
if (walEnabled || useCompatibilityWal) {
setJournalMode("WAL");
if (useCompatibilityWal && SQLiteCompatibilityWalFlags.areFlagsSet()) {
@@ -423,8 +425,8 @@
boolean foreignKeyModeChanged = configuration.foreignKeyConstraintsEnabled
!= mConfiguration.foreignKeyConstraintsEnabled;
boolean walModeChanged = ((configuration.openFlags ^ mConfiguration.openFlags)
- & SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING) != 0
- || configuration.useCompatibilityWal != mConfiguration.useCompatibilityWal;
+ & (SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING
+ | SQLiteDatabase.DISABLE_COMPATIBILITY_WAL)) != 0;
boolean localeChanged = !configuration.locale.equals(mConfiguration.locale);
// Update configuration parameters.
diff --git a/core/java/android/database/sqlite/SQLiteConnectionPool.java b/core/java/android/database/sqlite/SQLiteConnectionPool.java
index dc60612..dadb95b 100644
--- a/core/java/android/database/sqlite/SQLiteConnectionPool.java
+++ b/core/java/android/database/sqlite/SQLiteConnectionPool.java
@@ -315,7 +315,12 @@
}
}
- if (mConfiguration.openFlags != configuration.openFlags) {
+ // We should do in-place switching when transitioning from compatibility WAL
+ // to rollback journal. Otherwise transient connection state will be lost
+ boolean onlyCompatWalChanged = (mConfiguration.openFlags ^ configuration.openFlags)
+ == SQLiteDatabase.DISABLE_COMPATIBILITY_WAL;
+
+ if (!onlyCompatWalChanged && mConfiguration.openFlags != configuration.openFlags) {
// If we are changing open flags and WAL mode at the same time, then
// we have no choice but to close the primary connection beforehand
// because there can only be one connection open when we change WAL mode.
diff --git a/core/java/android/database/sqlite/SQLiteDatabase.java b/core/java/android/database/sqlite/SQLiteDatabase.java
index ae1f57d..b463d8d 100644
--- a/core/java/android/database/sqlite/SQLiteDatabase.java
+++ b/core/java/android/database/sqlite/SQLiteDatabase.java
@@ -253,6 +253,13 @@
public static final int ENABLE_WRITE_AHEAD_LOGGING = 0x20000000;
/**
+ * Open flag: Flag for {@link #openDatabase} to disable Compatibility WAL when opening database.
+ *
+ * @hide
+ */
+ public static final int DISABLE_COMPATIBILITY_WAL = 0x40000000;
+
+ /**
* Absolute max value that can be set by {@link #setMaxSqlCacheSize(int)}.
*
* Each prepared-statement is between 1K - 6K, depending on the complexity of the
@@ -288,10 +295,10 @@
mConfigurationLocked.idleConnectionTimeoutMs = effectiveTimeoutMs;
mConfigurationLocked.journalMode = journalMode;
mConfigurationLocked.syncMode = syncMode;
- mConfigurationLocked.useCompatibilityWal = SQLiteGlobal.isCompatibilityWalSupported();
- if (!mConfigurationLocked.isInMemoryDb() && SQLiteCompatibilityWalFlags.areFlagsSet()) {
- mConfigurationLocked.useCompatibilityWal = SQLiteCompatibilityWalFlags
- .isCompatibilityWalSupported();
+ if (!SQLiteGlobal.isCompatibilityWalSupported() || (
+ SQLiteCompatibilityWalFlags.areFlagsSet() && !SQLiteCompatibilityWalFlags
+ .isCompatibilityWalSupported())) {
+ mConfigurationLocked.openFlags |= DISABLE_COMPATIBILITY_WAL;
}
}
@@ -2082,21 +2089,21 @@
synchronized (mLock) {
throwIfNotOpenLocked();
- final boolean oldUseCompatibilityWal = mConfigurationLocked.useCompatibilityWal;
final int oldFlags = mConfigurationLocked.openFlags;
- if (!oldUseCompatibilityWal && (oldFlags & ENABLE_WRITE_AHEAD_LOGGING) == 0) {
+ final boolean walDisabled = (oldFlags & ENABLE_WRITE_AHEAD_LOGGING) == 0;
+ final boolean compatibilityWalDisabled = (oldFlags & DISABLE_COMPATIBILITY_WAL) != 0;
+ if (walDisabled && compatibilityWalDisabled) {
return;
}
mConfigurationLocked.openFlags &= ~ENABLE_WRITE_AHEAD_LOGGING;
- // If an app explicitly disables WAL, do not even use compatibility mode
- mConfigurationLocked.useCompatibilityWal = false;
+ // If an app explicitly disables WAL, compatibility mode should be disabled too
+ mConfigurationLocked.openFlags |= DISABLE_COMPATIBILITY_WAL;
try {
mConnectionPoolLocked.reconfigure(mConfigurationLocked);
} catch (RuntimeException ex) {
mConfigurationLocked.openFlags = oldFlags;
- mConfigurationLocked.useCompatibilityWal = oldUseCompatibilityWal;
throw ex;
}
}
diff --git a/core/java/android/database/sqlite/SQLiteDatabaseConfiguration.java b/core/java/android/database/sqlite/SQLiteDatabaseConfiguration.java
index a14df1e..275043f 100644
--- a/core/java/android/database/sqlite/SQLiteDatabaseConfiguration.java
+++ b/core/java/android/database/sqlite/SQLiteDatabaseConfiguration.java
@@ -111,15 +111,6 @@
public long idleConnectionTimeoutMs = Long.MAX_VALUE;
/**
- * Enables compatibility WAL mode. Applications cannot explicitly choose compatibility WAL mode,
- * therefore it is not exposed as a flag.
- *
- * <p>In this mode, only database journal mode will be changed, connection pool
- * size will still be limited to a single connection.
- */
- public boolean useCompatibilityWal;
-
- /**
* Journal mode to use when {@link SQLiteDatabase#ENABLE_WRITE_AHEAD_LOGGING} is not set.
* <p>Default is returned by {@link SQLiteGlobal#getDefaultJournalMode()}
*/
@@ -191,7 +182,6 @@
lookasideSlotSize = other.lookasideSlotSize;
lookasideSlotCount = other.lookasideSlotCount;
idleConnectionTimeoutMs = other.idleConnectionTimeoutMs;
- useCompatibilityWal = other.useCompatibilityWal;
journalMode = other.journalMode;
syncMode = other.syncMode;
}
diff --git a/core/java/android/database/sqlite/SQLiteOpenHelper.java b/core/java/android/database/sqlite/SQLiteOpenHelper.java
index 64e9e5d..7ff6635 100644
--- a/core/java/android/database/sqlite/SQLiteOpenHelper.java
+++ b/core/java/android/database/sqlite/SQLiteOpenHelper.java
@@ -197,6 +197,8 @@
}
mOpenParamsBuilder.setWriteAheadLoggingEnabled(enabled);
}
+ // Compatibility WAL is disabled if an app disables or enables WAL
+ mOpenParamsBuilder.addOpenFlags(SQLiteDatabase.DISABLE_COMPATIBILITY_WAL);
}
}
diff --git a/core/java/android/hardware/radio/RadioMetadata.java b/core/java/android/hardware/radio/RadioMetadata.java
index 3cc4b56..6e51060 100644
--- a/core/java/android/hardware/radio/RadioMetadata.java
+++ b/core/java/android/hardware/radio/RadioMetadata.java
@@ -96,6 +96,48 @@
*/
public static final String METADATA_KEY_CLOCK = "android.hardware.radio.metadata.CLOCK";
+ /**
+ * Technology-independent program name (station name).
+ */
+ public static final String METADATA_KEY_PROGRAM_NAME =
+ "android.hardware.radio.metadata.PROGRAM_NAME";
+
+ /**
+ * DAB ensemble name.
+ */
+ public static final String METADATA_KEY_DAB_ENSEMBLE_NAME =
+ "android.hardware.radio.metadata.DAB_ENSEMBLE_NAME";
+
+ /**
+ * DAB ensemble name - short version (up to 8 characters).
+ */
+ public static final String METADATA_KEY_DAB_ENSEMBLE_NAME_SHORT =
+ "android.hardware.radio.metadata.DAB_ENSEMBLE_NAME_SHORT";
+
+ /**
+ * DAB service name.
+ */
+ public static final String METADATA_KEY_DAB_SERVICE_NAME =
+ "android.hardware.radio.metadata.DAB_SERVICE_NAME";
+
+ /**
+ * DAB service name - short version (up to 8 characters).
+ */
+ public static final String METADATA_KEY_DAB_SERVICE_NAME_SHORT =
+ "android.hardware.radio.metadata.DAB_SERVICE_NAME_SHORT";
+
+ /**
+ * DAB component name.
+ */
+ public static final String METADATA_KEY_DAB_COMPONENT_NAME =
+ "android.hardware.radio.metadata.DAB_COMPONENT_NAME";
+
+ /**
+ * DAB component name.
+ */
+ public static final String METADATA_KEY_DAB_COMPONENT_NAME_SHORT =
+ "android.hardware.radio.metadata.DAB_COMPONENT_NAME_SHORT";
+
private static final int METADATA_TYPE_INVALID = -1;
private static final int METADATA_TYPE_INT = 0;
@@ -119,6 +161,13 @@
METADATA_KEYS_TYPE.put(METADATA_KEY_ICON, METADATA_TYPE_BITMAP);
METADATA_KEYS_TYPE.put(METADATA_KEY_ART, METADATA_TYPE_BITMAP);
METADATA_KEYS_TYPE.put(METADATA_KEY_CLOCK, METADATA_TYPE_CLOCK);
+ METADATA_KEYS_TYPE.put(METADATA_KEY_PROGRAM_NAME, METADATA_TYPE_TEXT);
+ METADATA_KEYS_TYPE.put(METADATA_KEY_DAB_ENSEMBLE_NAME, METADATA_TYPE_TEXT);
+ METADATA_KEYS_TYPE.put(METADATA_KEY_DAB_ENSEMBLE_NAME_SHORT, METADATA_TYPE_TEXT);
+ METADATA_KEYS_TYPE.put(METADATA_KEY_DAB_SERVICE_NAME, METADATA_TYPE_TEXT);
+ METADATA_KEYS_TYPE.put(METADATA_KEY_DAB_SERVICE_NAME_SHORT, METADATA_TYPE_TEXT);
+ METADATA_KEYS_TYPE.put(METADATA_KEY_DAB_COMPONENT_NAME, METADATA_TYPE_TEXT);
+ METADATA_KEYS_TYPE.put(METADATA_KEY_DAB_COMPONENT_NAME_SHORT, METADATA_TYPE_TEXT);
}
// keep in sync with: system/media/radio/include/system/radio_metadata.h
diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java
index 8588df7..a132730 100644
--- a/core/java/android/service/wallpaper/WallpaperService.java
+++ b/core/java/android/service/wallpaper/WallpaperService.java
@@ -788,8 +788,8 @@
com.android.internal.R.style.Animation_Wallpaper;
mInputChannel = new InputChannel();
if (mSession.addToDisplay(mWindow, mWindow.mSeq, mLayout, View.VISIBLE,
- Display.DEFAULT_DISPLAY, mContentInsets, mStableInsets, mOutsets,
- mDisplayCutout, mInputChannel) < 0) {
+ Display.DEFAULT_DISPLAY, mWinFrame, mContentInsets, mStableInsets,
+ mOutsets, mDisplayCutout, mInputChannel) < 0) {
Log.w(TAG, "Failed to add window while updating wallpaper surface.");
return;
}
diff --git a/core/java/android/util/apk/ApkSignatureSchemeV2Verifier.java b/core/java/android/util/apk/ApkSignatureSchemeV2Verifier.java
index 62222b5..533d725 100644
--- a/core/java/android/util/apk/ApkSignatureSchemeV2Verifier.java
+++ b/core/java/android/util/apk/ApkSignatureSchemeV2Verifier.java
@@ -213,7 +213,9 @@
byte[] verityRootHash = null;
if (contentDigests.containsKey(CONTENT_DIGEST_VERITY_CHUNKED_SHA256)) {
- verityRootHash = contentDigests.get(CONTENT_DIGEST_VERITY_CHUNKED_SHA256);
+ byte[] verityDigest = contentDigests.get(CONTENT_DIGEST_VERITY_CHUNKED_SHA256);
+ verityRootHash = ApkSigningBlockUtils.parseVerityDigestAndVerifySourceLength(
+ verityDigest, apk.length(), signatureInfo);
}
return new VerifiedSigner(
diff --git a/core/java/android/util/apk/ApkSignatureSchemeV3Verifier.java b/core/java/android/util/apk/ApkSignatureSchemeV3Verifier.java
index 9436b29..4431bcef1 100644
--- a/core/java/android/util/apk/ApkSignatureSchemeV3Verifier.java
+++ b/core/java/android/util/apk/ApkSignatureSchemeV3Verifier.java
@@ -165,7 +165,7 @@
private static VerifiedSigner verify(
RandomAccessFile apk,
SignatureInfo signatureInfo,
- boolean doVerifyIntegrity) throws SecurityException {
+ boolean doVerifyIntegrity) throws SecurityException, IOException {
int signerCount = 0;
Map<Integer, byte[]> contentDigests = new ArrayMap<>();
VerifiedSigner result = null;
@@ -214,7 +214,9 @@
}
if (contentDigests.containsKey(CONTENT_DIGEST_VERITY_CHUNKED_SHA256)) {
- result.verityRootHash = contentDigests.get(CONTENT_DIGEST_VERITY_CHUNKED_SHA256);
+ byte[] verityDigest = contentDigests.get(CONTENT_DIGEST_VERITY_CHUNKED_SHA256);
+ result.verityRootHash = ApkSigningBlockUtils.parseVerityDigestAndVerifySourceLength(
+ verityDigest, apk.length(), signatureInfo);
}
return result;
diff --git a/core/java/android/util/apk/ApkSigningBlockUtils.java b/core/java/android/util/apk/ApkSigningBlockUtils.java
index 40db758..1c67434 100644
--- a/core/java/android/util/apk/ApkSigningBlockUtils.java
+++ b/core/java/android/util/apk/ApkSigningBlockUtils.java
@@ -285,11 +285,46 @@
return result;
}
+ /**
+ * Return the verity digest only if the length of digest content looks correct.
+ * When verity digest is generated, the last incomplete 4k chunk is padded with 0s before
+ * hashing. This means two almost identical APKs with different number of 0 at the end will have
+ * the same verity digest. To avoid this problem, the length of the source content (excluding
+ * Signing Block) is appended to the verity digest, and the digest is returned only if the
+ * length is consistent to the current APK.
+ */
+ static byte[] parseVerityDigestAndVerifySourceLength(
+ byte[] data, long fileSize, SignatureInfo signatureInfo) throws SecurityException {
+ // FORMAT:
+ // OFFSET DATA TYPE DESCRIPTION
+ // * @+0 bytes uint8[32] Merkle tree root hash of SHA-256
+ // * @+32 bytes int64 Length of source data
+ int kRootHashSize = 32;
+ int kSourceLengthSize = 8;
+
+ if (data.length != kRootHashSize + kSourceLengthSize) {
+ throw new SecurityException("Verity digest size is wrong: " + data.length);
+ }
+ ByteBuffer buffer = ByteBuffer.wrap(data).order(ByteOrder.LITTLE_ENDIAN);
+ buffer.position(kRootHashSize);
+ long expectedSourceLength = buffer.getLong();
+
+ long signingBlockSize = signatureInfo.centralDirOffset
+ - signatureInfo.apkSigningBlockOffset;
+ if (expectedSourceLength != fileSize - signingBlockSize) {
+ throw new SecurityException("APK content size did not verify");
+ }
+
+ return Arrays.copyOfRange(data, 0, kRootHashSize);
+ }
+
private static void verifyIntegrityForVerityBasedAlgorithm(
- byte[] expectedRootHash,
+ byte[] expectedDigest,
RandomAccessFile apk,
SignatureInfo signatureInfo) throws SecurityException {
try {
+ byte[] expectedRootHash = parseVerityDigestAndVerifySourceLength(expectedDigest,
+ apk.length(), signatureInfo);
ApkVerityBuilder.ApkVerityResult verity = ApkVerityBuilder.generateApkVerity(apk,
signatureInfo, new ByteBufferFactory() {
@Override
@@ -373,9 +408,9 @@
static final int SIGNATURE_ECDSA_WITH_SHA256 = 0x0201;
static final int SIGNATURE_ECDSA_WITH_SHA512 = 0x0202;
static final int SIGNATURE_DSA_WITH_SHA256 = 0x0301;
- static final int SIGNATURE_VERITY_RSA_PKCS1_V1_5_WITH_SHA256 = 0x0411;
- static final int SIGNATURE_VERITY_ECDSA_WITH_SHA256 = 0x0413;
- static final int SIGNATURE_VERITY_DSA_WITH_SHA256 = 0x0415;
+ static final int SIGNATURE_VERITY_RSA_PKCS1_V1_5_WITH_SHA256 = 0x0421;
+ static final int SIGNATURE_VERITY_ECDSA_WITH_SHA256 = 0x0423;
+ static final int SIGNATURE_VERITY_DSA_WITH_SHA256 = 0x0425;
static final int CONTENT_DIGEST_CHUNKED_SHA256 = 1;
static final int CONTENT_DIGEST_CHUNKED_SHA512 = 2;
diff --git a/core/java/android/view/IWindowSession.aidl b/core/java/android/view/IWindowSession.aidl
index d7fd329..d8a5609 100644
--- a/core/java/android/view/IWindowSession.aidl
+++ b/core/java/android/view/IWindowSession.aidl
@@ -41,8 +41,8 @@
in int viewVisibility, out Rect outContentInsets, out Rect outStableInsets,
out InputChannel outInputChannel);
int addToDisplay(IWindow window, int seq, in WindowManager.LayoutParams attrs,
- in int viewVisibility, in int layerStackId, out Rect outContentInsets,
- out Rect outStableInsets, out Rect outOutsets,
+ in int viewVisibility, in int layerStackId, out Rect outFrame,
+ out Rect outContentInsets, out Rect outStableInsets, out Rect outOutsets,
out DisplayCutout.ParcelableWrapper displayCutout, out InputChannel outInputChannel);
int addWithoutInputChannel(IWindow window, int seq, in WindowManager.LayoutParams attrs,
in int viewVisibility, out Rect outContentInsets, out Rect outStableInsets);
diff --git a/core/java/android/view/ThreadedRenderer.java b/core/java/android/view/ThreadedRenderer.java
index e996ea1..8d076f7 100644
--- a/core/java/android/view/ThreadedRenderer.java
+++ b/core/java/android/view/ThreadedRenderer.java
@@ -1068,11 +1068,15 @@
mInitialized = true;
mAppContext = context.getApplicationContext();
- nSetDebuggingEnabled(
- (mAppContext.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0
- || Build.IS_DEBUGGABLE);
initSched(renderProxy);
- initGraphicsStats();
+
+ if (mAppContext != null) {
+ final boolean appDebuggable =
+ (mAppContext.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE)
+ != 0;
+ nSetDebuggingEnabled(appDebuggable || Build.IS_DEBUGGABLE);
+ initGraphicsStats();
+ }
}
private void initSched(long renderProxy) {
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 853375e..bf0e2eb 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -7289,16 +7289,18 @@
}
/**
- * If this view is a visually distinct portion of a window, for example the content view of
- * a fragment that is replaced, it is considered a pane for accessibility purposes. In order
- * for accessibility services to understand the views role, and to announce its title as
- * appropriate, such views should have pane titles.
+ * Visually distinct portion of a window with window-like semantics are considered panes for
+ * accessibility purposes. One example is the content view of a fragment that is replaced.
+ * In order for accessibility services to understand a pane's window-like behavior, panes
+ * should have descriptive titles. Views with pane titles produce {@link AccessibilityEvent}s
+ * when they appear, disappear, or change title.
*
- * @param accessibilityPaneTitle The pane's title.
+ * @param accessibilityPaneTitle The pane's title. Setting to {@code null} indicates that this
+ * View is not a pane.
*
* {@see AccessibilityNodeInfo#setPaneTitle(CharSequence)}
*/
- public void setAccessibilityPaneTitle(CharSequence accessibilityPaneTitle) {
+ public void setAccessibilityPaneTitle(@Nullable CharSequence accessibilityPaneTitle) {
if (!TextUtils.equals(accessibilityPaneTitle, mAccessibilityPaneTitle)) {
mAccessibilityPaneTitle = accessibilityPaneTitle;
notifyViewAccessibilityStateChangedIfNeeded(
@@ -7313,7 +7315,7 @@
*
* {@see #setAccessibilityPaneTitle}.
*/
- public CharSequence getAccessibilityPaneTitle() {
+ @Nullable public CharSequence getAccessibilityPaneTitle() {
return mAccessibilityPaneTitle;
}
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 95e4abb..d908e79 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -753,7 +753,7 @@
mAttachInfo.mRecomputeGlobalAttributes = true;
collectViewAttributes();
res = mWindowSession.addToDisplay(mWindow, mSeq, mWindowAttributes,
- getHostVisibility(), mDisplay.getDisplayId(),
+ getHostVisibility(), mDisplay.getDisplayId(), mWinFrame,
mAttachInfo.mContentInsets, mAttachInfo.mStableInsets,
mAttachInfo.mOutsets, mAttachInfo.mDisplayCutout, mInputChannel);
} catch (RemoteException e) {
@@ -1711,8 +1711,8 @@
desiredWindowWidth = size.x;
desiredWindowHeight = size.y;
} else {
- desiredWindowWidth = dipToPx(config.screenWidthDp);
- desiredWindowHeight = dipToPx(config.screenHeightDp);
+ desiredWindowWidth = mWinFrame.width();
+ desiredWindowHeight = mWinFrame.height();
}
// We used to use the following condition to choose 32 bits drawing caches:
diff --git a/core/java/android/view/accessibility/AccessibilityNodeInfo.java b/core/java/android/view/accessibility/AccessibilityNodeInfo.java
index 5b1dd5c..fdd3f73 100644
--- a/core/java/android/view/accessibility/AccessibilityNodeInfo.java
+++ b/core/java/android/view/accessibility/AccessibilityNodeInfo.java
@@ -3333,7 +3333,7 @@
final int actionCount = mActions.size();
int nonStandardActionCount = 0;
- int defaultStandardActions = 0;
+ long defaultStandardActions = 0;
for (int i = 0; i < actionCount; i++) {
AccessibilityAction action = mActions.get(i);
if (isDefaultStandardAction(action)) {
@@ -3342,7 +3342,7 @@
nonStandardActionCount++;
}
}
- parcel.writeInt(defaultStandardActions);
+ parcel.writeLong(defaultStandardActions);
parcel.writeInt(nonStandardActionCount);
for (int i = 0; i < actionCount; i++) {
@@ -3353,7 +3353,7 @@
}
}
} else {
- parcel.writeInt(0);
+ parcel.writeLong(0);
parcel.writeInt(0);
}
}
@@ -3540,7 +3540,7 @@
}
if (isBitSet(nonDefaultFields, fieldIndex++)) {
- final int standardActions = parcel.readInt();
+ final long standardActions = parcel.readLong();
addStandardActions(standardActions);
final int nonStandardActionCount = parcel.readInt();
for (int i = 0; i < nonStandardActionCount; i++) {
@@ -3621,7 +3621,7 @@
}
private static boolean isDefaultStandardAction(AccessibilityAction action) {
- return action.mSerializationFlag != -1 && TextUtils.isEmpty(action.getLabel());
+ return (action.mSerializationFlag != -1L) && TextUtils.isEmpty(action.getLabel());
}
private static AccessibilityAction getActionSingleton(int actionId) {
@@ -3636,7 +3636,7 @@
return null;
}
- private static AccessibilityAction getActionSingletonBySerializationFlag(int flag) {
+ private static AccessibilityAction getActionSingletonBySerializationFlag(long flag) {
final int actions = AccessibilityAction.sStandardActions.size();
for (int i = 0; i < actions; i++) {
AccessibilityAction currentAction = AccessibilityAction.sStandardActions.valueAt(i);
@@ -3648,10 +3648,10 @@
return null;
}
- private void addStandardActions(int serializationIdMask) {
- int remainingIds = serializationIdMask;
+ private void addStandardActions(long serializationIdMask) {
+ long remainingIds = serializationIdMask;
while (remainingIds > 0) {
- final int id = 1 << Integer.numberOfTrailingZeros(remainingIds);
+ final long id = 1L << Long.numberOfTrailingZeros(remainingIds);
remainingIds &= ~id;
AccessibilityAction action = getActionSingletonBySerializationFlag(id);
addAction(action);
@@ -4276,7 +4276,7 @@
private final CharSequence mLabel;
/** @hide */
- public int mSerializationFlag = -1;
+ public long mSerializationFlag = -1L;
/**
* Creates a new AccessibilityAction. For adding a standard action without a specific label,
@@ -4310,7 +4310,7 @@
private AccessibilityAction(int standardActionId) {
this(standardActionId, null);
- mSerializationFlag = (int) bitAt(sStandardActions.size());
+ mSerializationFlag = bitAt(sStandardActions.size());
sStandardActions.add(this);
}
diff --git a/core/java/android/widget/SearchView.java b/core/java/android/widget/SearchView.java
index 519a7dd..225497b 100644
--- a/core/java/android/widget/SearchView.java
+++ b/core/java/android/widget/SearchView.java
@@ -1990,28 +1990,15 @@
@Override
public boolean onKeyPreIme(int keyCode, KeyEvent event) {
- if (keyCode == KeyEvent.KEYCODE_BACK) {
- // special case for the back key, we do not even try to send it
- // to the drop down list but instead, consume it immediately
- if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) {
- KeyEvent.DispatcherState state = getKeyDispatcherState();
- if (state != null) {
- state.startTracking(event, this);
- }
- return true;
- } else if (event.getAction() == KeyEvent.ACTION_UP) {
- KeyEvent.DispatcherState state = getKeyDispatcherState();
- if (state != null) {
- state.handleUpEvent(event);
- }
- if (event.isTracking() && !event.isCanceled()) {
- mSearchView.clearFocus();
- setImeVisibility(false);
- return true;
- }
- }
+ final boolean consume = super.onKeyPreIme(keyCode, event);
+ if (consume && keyCode == KeyEvent.KEYCODE_BACK
+ && event.getAction() == KeyEvent.ACTION_UP) {
+ // If AutoCompleteTextView closed its pop-up, it will return true, in which case
+ // we should also close the IME. Otherwise, the popup is already closed and we can
+ // leave the BACK event alone.
+ setImeVisibility(false);
}
- return super.onKeyPreIme(keyCode, event);
+ return consume;
}
/**
diff --git a/core/java/com/android/internal/os/KernelUidCpuActiveTimeReader.java b/core/java/com/android/internal/os/KernelUidCpuActiveTimeReader.java
index ce45f3c..e790e08 100644
--- a/core/java/com/android/internal/os/KernelUidCpuActiveTimeReader.java
+++ b/core/java/com/android/internal/os/KernelUidCpuActiveTimeReader.java
@@ -123,6 +123,17 @@
}
}
+ public void readAbsolute(Callback cb) {
+ synchronized (mProcReader) {
+ readDelta(null);
+ int total = mLastUidCpuActiveTimeMs.size();
+ for (int i = 0; i < total; i ++){
+ int uid = mLastUidCpuActiveTimeMs.keyAt(i);
+ cb.onUidCpuActiveTime(uid, mLastUidCpuActiveTimeMs.get(uid).longValue());
+ }
+ }
+ }
+
public void removeUid(int uid) {
mLastUidCpuActiveTimeMs.delete(uid);
}
diff --git a/core/java/com/android/internal/os/KernelUidCpuClusterTimeReader.java b/core/java/com/android/internal/os/KernelUidCpuClusterTimeReader.java
index c21b766..bf5b520 100644
--- a/core/java/com/android/internal/os/KernelUidCpuClusterTimeReader.java
+++ b/core/java/com/android/internal/os/KernelUidCpuClusterTimeReader.java
@@ -65,6 +65,7 @@
private double[] mCurTime; // Reuse to avoid GC.
private long[] mDeltaTime; // Reuse to avoid GC.
+ private long[] mCurTimeRounded; // Reuse to avoid GC.
public interface Callback extends KernelUidCpuTimeReaderBase.Callback {
/**
@@ -137,6 +138,21 @@
}
}
+ public void readAbsolute(Callback cb) {
+ synchronized (mProcReader) {
+ readDelta(null);
+ int total = mLastUidPolicyTimeMs.size();
+ for (int i = 0; i < total; i ++){
+ int uid = mLastUidPolicyTimeMs.keyAt(i);
+ double[] lastTimes = mLastUidPolicyTimeMs.get(uid);
+ for (int j = 0; j < mNumClusters; j++) {
+ mCurTimeRounded[j] = (long) lastTimes[j];
+ }
+ cb.onUidCpuPolicyTime(uid, mCurTimeRounded);
+ }
+ }
+ }
+
private void processUid(IntBuffer buf, @Nullable Callback cb) {
int uid = buf.get();
double[] lastTimes = mLastUidPolicyTimeMs.get(uid);
@@ -189,6 +205,7 @@
mNumCoresOnCluster = numCoresOnCluster;
mCurTime = new double[numClusters];
mDeltaTime = new long[numClusters];
+ mCurTimeRounded = new long[numClusters];
return true;
}
diff --git a/core/java/com/android/internal/os/KernelUidCpuFreqTimeReader.java b/core/java/com/android/internal/os/KernelUidCpuFreqTimeReader.java
index a0787a0..f65074f 100644
--- a/core/java/com/android/internal/os/KernelUidCpuFreqTimeReader.java
+++ b/core/java/com/android/internal/os/KernelUidCpuFreqTimeReader.java
@@ -226,6 +226,17 @@
}
}
+ public void readAbsolute(Callback cb) {
+ synchronized (mProcReader) {
+ readDelta(null);
+ int total = mLastUidCpuFreqTimeMs.size();
+ for (int i = 0; i < total; i ++){
+ int uid = mLastUidCpuFreqTimeMs.keyAt(i);
+ cb.onUidCpuFreqTime(uid, mLastUidCpuFreqTimeMs.get(uid));
+ }
+ }
+ }
+
public void removeUid(int uid) {
mLastUidCpuFreqTimeMs.delete(uid);
}
diff --git a/core/java/com/android/internal/os/KernelUidCpuTimeReader.java b/core/java/com/android/internal/os/KernelUidCpuTimeReader.java
index 4263b83..97b7211 100644
--- a/core/java/com/android/internal/os/KernelUidCpuTimeReader.java
+++ b/core/java/com/android/internal/os/KernelUidCpuTimeReader.java
@@ -135,6 +135,30 @@
}
/**
+ * Reads the proc file, calling into the callback with raw absolute value of time for each UID.
+ * @param callback The callback to invoke for each line of the proc file.
+ */
+ public void readAbsolute(Callback callback) {
+ final int oldMask = StrictMode.allowThreadDiskReadsMask();
+ try (BufferedReader reader = new BufferedReader(new FileReader(sProcFile))) {
+ TextUtils.SimpleStringSplitter splitter = new TextUtils.SimpleStringSplitter(' ');
+ String line;
+ while ((line = reader.readLine()) != null) {
+ splitter.setString(line);
+ final String uidStr = splitter.next();
+ final int uid = Integer.parseInt(uidStr.substring(0, uidStr.length() - 1), 10);
+ final long userTimeUs = Long.parseLong(splitter.next(), 10);
+ final long systemTimeUs = Long.parseLong(splitter.next(), 10);
+ callback.onUidCpuTime(uid, userTimeUs, systemTimeUs);
+ }
+ } catch (IOException e) {
+ Slog.e(TAG, "Failed to read uid_cputime: " + e.getMessage());
+ } finally {
+ StrictMode.setThreadPolicyMask(oldMask);
+ }
+ }
+
+ /**
* Removes the UID from the kernel module and from internal accounting data. Only
* {@link BatteryStatsImpl} and its child processes should call this, as the change on Kernel is
* visible system wide.
diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java
index e871003..7eb2f38 100644
--- a/core/java/com/android/internal/widget/LockPatternUtils.java
+++ b/core/java/com/android/internal/widget/LockPatternUtils.java
@@ -42,6 +42,7 @@
import android.text.TextUtils;
import android.util.Log;
import android.util.SparseIntArray;
+import android.util.SparseLongArray;
import com.android.internal.annotations.VisibleForTesting;
import com.google.android.collect.Lists;
@@ -120,8 +121,6 @@
@Deprecated
public final static String LOCKOUT_PERMANENT_KEY = "lockscreen.lockedoutpermanently";
- public final static String LOCKOUT_ATTEMPT_DEADLINE = "lockscreen.lockoutattemptdeadline";
- public final static String LOCKOUT_ATTEMPT_TIMEOUT_MS = "lockscreen.lockoutattempttimeoutmss";
public final static String PATTERN_EVER_CHOSEN_KEY = "lockscreen.patterneverchosen";
public final static String PASSWORD_TYPE_KEY = "lockscreen.password_type";
@Deprecated
@@ -164,6 +163,7 @@
private ILockSettings mLockSettingsService;
private UserManager mUserManager;
private final Handler mHandler;
+ private final SparseLongArray mLockoutDeadlines = new SparseLongArray();
/**
* Use {@link TrustManager#isTrustUsuallyManaged(int)}.
@@ -1237,8 +1237,7 @@
// enforces the deadline. Since we cannot store settings for the FRP user, don't.
return deadline;
}
- setLong(LOCKOUT_ATTEMPT_DEADLINE, deadline, userId);
- setLong(LOCKOUT_ATTEMPT_TIMEOUT_MS, timeoutMs, userId);
+ mLockoutDeadlines.put(userId, deadline);
return deadline;
}
@@ -1248,22 +1247,13 @@
* enter a pattern.
*/
public long getLockoutAttemptDeadline(int userId) {
- long deadline = getLong(LOCKOUT_ATTEMPT_DEADLINE, 0L, userId);
- final long timeoutMs = getLong(LOCKOUT_ATTEMPT_TIMEOUT_MS, 0L, userId);
+ final long deadline = mLockoutDeadlines.get(userId, 0L);
final long now = SystemClock.elapsedRealtime();
if (deadline < now && deadline != 0) {
// timeout expired
- setLong(LOCKOUT_ATTEMPT_DEADLINE, 0, userId);
- setLong(LOCKOUT_ATTEMPT_TIMEOUT_MS, 0, userId);
+ mLockoutDeadlines.put(userId, 0);
return 0L;
}
-
- if (deadline > (now + timeoutMs)) {
- // device was rebooted, set new deadline
- deadline = now + timeoutMs;
- setLong(LOCKOUT_ATTEMPT_DEADLINE, deadline, userId);
- }
-
return deadline;
}
diff --git a/core/jni/android_media_AudioFormat.h b/core/jni/android_media_AudioFormat.h
index 12da273..da4cdb6 100644
--- a/core/jni/android_media_AudioFormat.h
+++ b/core/jni/android_media_AudioFormat.h
@@ -78,11 +78,11 @@
case ENCODING_AAC_ELD:
return AUDIO_FORMAT_AAC_ELD;
case ENCODING_AAC_XHE:
- return AUDIO_FORMAT_AAC; // FIXME temporary value, needs addition of xHE-AAC
+ return AUDIO_FORMAT_AAC_XHE;
case ENCODING_AC4:
return AUDIO_FORMAT_AC4;
- // case ENCODING_E_AC3_JOC: // FIXME Not defined on the native side yet
- // return AUDIO_FORMAT_E_AC3_JOC;
+ case ENCODING_E_AC3_JOC:
+ return AUDIO_FORMAT_E_AC3_JOC;
case ENCODING_DEFAULT:
return AUDIO_FORMAT_DEFAULT;
default:
@@ -133,8 +133,8 @@
// return ENCODING_AAC_XHE;
case AUDIO_FORMAT_AC4:
return ENCODING_AC4;
- // case AUDIO_FORMAT_E_AC3_JOC: // FIXME Not defined on the native side yet
- // return ENCODING_E_AC3_JOC;
+ case AUDIO_FORMAT_E_AC3_JOC:
+ return ENCODING_E_AC3_JOC;
case AUDIO_FORMAT_DEFAULT:
return ENCODING_DEFAULT;
default:
diff --git a/core/res/res/color/control_nodisable_material.xml b/core/res/res/color/config_progress_background_tint.xml
similarity index 92%
rename from core/res/res/color/control_nodisable_material.xml
rename to core/res/res/color/config_progress_background_tint.xml
index 4a73e93..b086e20 100644
--- a/core/res/res/color/control_nodisable_material.xml
+++ b/core/res/res/color/config_progress_background_tint.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2015 The Android Open Source Project
+<!-- 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.
diff --git a/core/res/res/drawable/progress_horizontal_material.xml b/core/res/res/drawable/progress_horizontal_material.xml
index 2f94d0c..d59abf4 100644
--- a/core/res/res/drawable/progress_horizontal_material.xml
+++ b/core/res/res/drawable/progress_horizontal_material.xml
@@ -18,7 +18,7 @@
<item android:id="@id/background"
android:gravity="center_vertical|fill_horizontal">
<shape android:shape="rectangle"
- android:tint="?attr/colorControlNormal">
+ android:tint="?attr/colorProgressBackgroundNormal">
<corners android:radius="?attr/progressBarCornerRadius" />
<size android:height="@dimen/progress_bar_height_material" />
<solid android:color="@color/white_disabled_material" />
diff --git a/core/res/res/drawable/seekbar_track_material.xml b/core/res/res/drawable/seekbar_track_material.xml
index 62ef136..2076fee 100644
--- a/core/res/res/drawable/seekbar_track_material.xml
+++ b/core/res/res/drawable/seekbar_track_material.xml
@@ -18,7 +18,7 @@
<item android:id="@id/background"
android:gravity="center_vertical|fill_horizontal">
<shape android:shape="rectangle"
- android:tint="@color/control_nodisable_material">
+ android:tint="?attr/colorProgressBackgroundNormal">
<corners android:radius="?attr/progressBarCornerRadius" />
<size android:height="@dimen/seekbar_track_background_height_material" />
<solid android:color="@color/white_disabled_material" />
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 796030e..021e88e 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -1114,6 +1114,9 @@
<!-- The color applied to framework switch thumbs in their normal state. -->
<attr name="colorSwitchThumbNormal" format="color" />
+ <!-- The color applied to framework progress and seek bar backgrounds in their normal state. -->
+ <attr name="colorProgressBackgroundNormal" format="color" />
+
<!-- The color applied to the edge effect on scrolling containers. -->
<attr name="colorEdgeEffect" format="color" />
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 979a0d6..fa0fb94 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -2457,6 +2457,7 @@
<java-symbol type="bool" name="config_defaultWindowFeatureOptionsPanel" />
<java-symbol type="bool" name="config_defaultWindowFeatureContextMenu" />
<java-symbol type="bool" name="config_overrideRemoteViewsActivityTransition" />
+ <java-symbol type="attr" name="colorProgressBackgroundNormal" />
<java-symbol type="layout" name="simple_account_item" />
<java-symbol type="string" name="prohibit_manual_network_selection_in_gobal_mode" />
diff --git a/core/res/res/values/themes_device_defaults.xml b/core/res/res/values/themes_device_defaults.xml
index cb11d8d..fdbcd8a 100644
--- a/core/res/res/values/themes_device_defaults.xml
+++ b/core/res/res/values/themes_device_defaults.xml
@@ -127,6 +127,7 @@
<item name="progressBarStyleSmallInverse">@style/Widget.DeviceDefault.ProgressBar.Small.Inverse</item>
<item name="progressBarStyleLargeInverse">@style/Widget.DeviceDefault.ProgressBar.Large.Inverse</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="seekBarStyle">@style/Widget.DeviceDefault.SeekBar</item>
<item name="ratingBarStyle">@style/Widget.DeviceDefault.RatingBar</item>
<item name="ratingBarStyleIndicator">@style/Widget.DeviceDefault.RatingBar.Indicator</item>
@@ -230,6 +231,7 @@
<item name="buttonBarButtonStyle">@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -253,6 +255,7 @@
<item name="buttonBarButtonStyle">@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -278,6 +281,7 @@
<item name="buttonBarButtonStyle">@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -302,6 +306,7 @@
<item name="buttonBarButtonStyle">@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -334,6 +339,7 @@
<item name="alertDialogTheme">@style/Theme.DeviceDefault.Dialog.Alert</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -357,6 +363,7 @@
<item name="buttonBarButtonStyle">@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -379,6 +386,7 @@
<item name="buttonBarButtonStyle">@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -402,6 +410,7 @@
<item name="buttonBarButtonStyle">@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -441,6 +450,7 @@
<item name="buttonBarButtonStyle">@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -465,6 +475,7 @@
<item name="buttonBarButtonStyle">@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -487,6 +498,7 @@
<item name="buttonBarButtonStyle">@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -511,6 +523,7 @@
<item name="buttonBarButtonStyle">@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -534,6 +547,7 @@
<item name="buttonBarButtonStyle">@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -557,6 +571,7 @@
<item name="buttonBarButtonStyle">@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -580,6 +595,7 @@
<item name="buttonBarButtonStyle">@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -603,6 +619,7 @@
<item name="buttonBarButtonStyle">@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -626,6 +643,7 @@
<item name="buttonBarButtonStyle">@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -647,6 +665,7 @@
<item name="buttonBarButtonStyle">@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -668,6 +687,7 @@
<item name="buttonBarButtonStyle">@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -748,6 +768,7 @@
<item name="progressBarStyleSmallInverse">@style/Widget.DeviceDefault.Light.ProgressBar.Small.Inverse</item>
<item name="progressBarStyleLargeInverse">@style/Widget.DeviceDefault.Light.ProgressBar.Large.Inverse</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="seekBarStyle">@style/Widget.DeviceDefault.Light.SeekBar</item>
<item name="ratingBarStyle">@style/Widget.DeviceDefault.Light.RatingBar</item>
<item name="ratingBarStyleIndicator">@style/Widget.DeviceDefault.Light.RatingBar.Indicator</item>
@@ -846,6 +867,7 @@
<item name="buttonBarButtonStyle">@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -868,6 +890,7 @@
<item name="buttonBarButtonStyle">@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -891,6 +914,7 @@
<item name="buttonBarButtonStyle">@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -916,6 +940,7 @@
<item name="buttonBarButtonStyle">@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -940,6 +965,7 @@
<item name="buttonBarButtonStyle">@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -970,6 +996,7 @@
<item name="colorAccent">@color/accent_device_default_light</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -993,6 +1020,7 @@
<item name="buttonBarButtonStyle">@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -1015,6 +1043,7 @@
<item name="buttonBarButtonStyle">@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -1038,6 +1067,7 @@
<item name="buttonBarButtonStyle">@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -1087,6 +1117,7 @@
<item name="buttonBarButtonStyle">@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -1111,6 +1142,7 @@
<item name="buttonBarButtonStyle">@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -1133,6 +1165,7 @@
<item name="buttonBarButtonStyle">@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -1157,6 +1190,7 @@
<item name="buttonBarButtonStyle">@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -1180,6 +1214,7 @@
<item name="buttonBarButtonStyle">@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -1201,6 +1236,7 @@
<item name="buttonBarButtonStyle">@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -1222,6 +1258,7 @@
<item name="buttonBarButtonStyle">@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -1256,6 +1293,7 @@
<item name="buttonBarButtonStyle">@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -1278,6 +1316,7 @@
<item name="buttonBarButtonStyle">@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -1290,6 +1329,7 @@
<item name="alertDialogTheme">@style/Theme.DeviceDefault.Light.Dialog.Alert</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -1313,6 +1353,7 @@
<item name="buttonBarButtonStyle">@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -1335,6 +1376,7 @@
<item name="buttonBarButtonStyle">@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -1357,6 +1399,7 @@
<item name="buttonBarButtonStyle">@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -1379,6 +1422,7 @@
<item name="buttonBarButtonStyle">@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
@@ -1408,6 +1452,7 @@
<item name="colorAccent">@color/accent_device_default_light</item>
<!-- Progress bar attributes -->
+ <item name="colorProgressBackgroundNormal">@color/config_progress_background_tint</item>
<item name="progressBarCornerRadius">@dimen/config_progressBarCornerRadius</item>
</style>
diff --git a/core/res/res/values/themes_material.xml b/core/res/res/values/themes_material.xml
index 76d9ea6..9b633fc 100644
--- a/core/res/res/values/themes_material.xml
+++ b/core/res/res/values/themes_material.xml
@@ -403,6 +403,7 @@
<item name="colorControlHighlight">@color/ripple_material_dark</item>
<item name="colorButtonNormal">@color/btn_default_material_dark</item>
<item name="colorSwitchThumbNormal">@color/switch_thumb_material_dark</item>
+ <item name="colorProgressBackgroundNormal">?attr/colorControlNormal</item>
<!-- Tooltip popup properties -->
<item name="tooltipForegroundColor">@color/foreground_material_light</item>
@@ -777,6 +778,7 @@
<item name="colorControlHighlight">@color/ripple_material_light</item>
<item name="colorButtonNormal">@color/btn_default_material_light</item>
<item name="colorSwitchThumbNormal">@color/switch_thumb_material_light</item>
+ <item name="colorProgressBackgroundNormal">?attr/colorControlNormal</item>
<!-- Tooltip popup properties -->
<item name="tooltipForegroundColor">@color/foreground_material_dark</item>
@@ -837,6 +839,7 @@
<item name="colorControlHighlight">@color/ripple_material_light</item>
<item name="colorButtonNormal">@color/btn_default_material_light</item>
<item name="colorSwitchThumbNormal">@color/switch_thumb_material_light</item>
+ <item name="colorProgressBackgroundNormal">?attr/colorControlNormal</item>
</style>
<!-- Theme overlay that replaces colors with their dark versions but preserves
@@ -870,6 +873,7 @@
<item name="colorControlHighlight">@color/ripple_material_dark</item>
<item name="colorButtonNormal">@color/btn_default_material_dark</item>
<item name="colorSwitchThumbNormal">@color/switch_thumb_material_dark</item>
+ <item name="colorProgressBackgroundNormal">?attr/colorControlNormal</item>
</style>
<!-- Theme overlay that replaces the normal control color, which by default is the same as the
diff --git a/core/tests/coretests/src/android/graphics/drawable/AdaptiveIconDrawableTest.java b/core/tests/coretests/src/android/graphics/drawable/AdaptiveIconDrawableTest.java
index b28a4b5..781e343 100644
--- a/core/tests/coretests/src/android/graphics/drawable/AdaptiveIconDrawableTest.java
+++ b/core/tests/coretests/src/android/graphics/drawable/AdaptiveIconDrawableTest.java
@@ -1,15 +1,11 @@
package android.graphics.drawable;
-import static org.junit.Assert.assertTrue;
-
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
-import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Outline;
-import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Path.Direction;
import android.graphics.Rect;
@@ -19,10 +15,12 @@
import android.test.AndroidTestCase;
import android.util.Log;
import android.util.PathParser;
+
+import org.junit.Test;
+
import java.io.File;
import java.io.FileOutputStream;
import java.util.Arrays;
-import org.junit.Test;
@LargeTest
public class AdaptiveIconDrawableTest extends AndroidTestCase {
@@ -173,6 +171,28 @@
assertTrue("outline path should be convex", outline.mPath.isConvex());
}
+ @Test
+ public void testSetAlpha() throws Exception {
+ mIconDrawable = new AdaptiveIconDrawable(mBackgroundDrawable, mForegroundDrawable);
+ mIconDrawable.setBounds(0, 0, 100, 100);
+
+ Bitmap bitmap = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888);
+ Canvas canvas = new Canvas(bitmap);
+
+ mIconDrawable.draw(canvas);
+ assertEquals(255, Color.alpha(bitmap.getPixel(50, 50)));
+
+ mIconDrawable.setAlpha(200);
+ bitmap.eraseColor(Color.TRANSPARENT);
+ mIconDrawable.draw(canvas);
+ assertEquals(200, Color.alpha(bitmap.getPixel(50, 50)));
+
+ mIconDrawable.setAlpha(100);
+ bitmap.eraseColor(Color.TRANSPARENT);
+ mIconDrawable.draw(canvas);
+ assertEquals(100, Color.alpha(bitmap.getPixel(50, 50)));
+ }
+
//
// Utils
//
diff --git a/core/tests/coretests/src/android/view/accessibility/AccessibilityNodeInfoTest.java b/core/tests/coretests/src/android/view/accessibility/AccessibilityNodeInfoTest.java
index b135025..8db1bfa 100644
--- a/core/tests/coretests/src/android/view/accessibility/AccessibilityNodeInfoTest.java
+++ b/core/tests/coretests/src/android/view/accessibility/AccessibilityNodeInfoTest.java
@@ -16,8 +16,13 @@
package android.view.accessibility;
+import static org.hamcrest.Matchers.emptyCollectionOf;
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.hasItem;
+import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
+import android.os.Parcel;
import android.support.test.filters.LargeTest;
import android.support.test.runner.AndroidJUnit4;
import android.util.ArraySet;
@@ -38,10 +43,10 @@
public void testStandardActions_serializationFlagIsValid() {
AccessibilityAction brokenStandardAction = CollectionUtils.find(
new ArrayList<>(AccessibilityAction.sStandardActions),
- action -> Integer.bitCount(action.mSerializationFlag) != 1);
+ action -> Long.bitCount(action.mSerializationFlag) != 1);
if (brokenStandardAction != null) {
String message = "Invalid serialization flag(0x"
- + Integer.toHexString(brokenStandardAction.mSerializationFlag)
+ + Long.toHexString(brokenStandardAction.mSerializationFlag)
+ ") in " + brokenStandardAction;
if (brokenStandardAction.mSerializationFlag == 0L) {
message += "\nThis is likely due to an overflow";
@@ -56,7 +61,7 @@
&& action.getId() != action.mSerializationFlag);
if (brokenStandardAction != null) {
fail("Serialization flag(0x"
- + Integer.toHexString(brokenStandardAction.mSerializationFlag)
+ + Long.toHexString(brokenStandardAction.mSerializationFlag)
+ ") is different from legacy action id(0x"
+ Integer.toHexString(brokenStandardAction.getId())
+ ") in " + brokenStandardAction);
@@ -77,4 +82,36 @@
}
}
+ @Test
+ public void testStandardActions_allComeThroughParceling() {
+ for (AccessibilityAction action : AccessibilityAction.sStandardActions) {
+ final AccessibilityNodeInfo nodeWithAction = AccessibilityNodeInfo.obtain();
+ nodeWithAction.addAction(action);
+ assertThat(nodeWithAction.getActionList(), hasItem(action));
+ final Parcel parcel = Parcel.obtain();
+ nodeWithAction.writeToParcel(parcel, 0);
+ parcel.setDataPosition(0);
+ final AccessibilityNodeInfo unparceledNode =
+ AccessibilityNodeInfo.CREATOR.createFromParcel(parcel);
+ assertThat(unparceledNode.getActionList(), hasItem(action));
+ }
+ }
+
+ @Test
+ public void testEmptyListOfActions_parcelsCorrectly() {
+ // Also set text, as if there's nothing else in the parcel it can unparcel even with
+ // a bug present.
+ final String text = "text";
+ final AccessibilityNodeInfo nodeWithEmptyActionList = AccessibilityNodeInfo.obtain();
+ nodeWithEmptyActionList.addAction(AccessibilityAction.ACTION_ACCESSIBILITY_FOCUS);
+ nodeWithEmptyActionList.removeAction(AccessibilityAction.ACTION_ACCESSIBILITY_FOCUS);
+ nodeWithEmptyActionList.setText(text);
+ final Parcel parcel = Parcel.obtain();
+ nodeWithEmptyActionList.writeToParcel(parcel, 0);
+ parcel.setDataPosition(0);
+ final AccessibilityNodeInfo unparceledNode =
+ AccessibilityNodeInfo.CREATOR.createFromParcel(parcel);
+ assertThat(unparceledNode.getActionList(), emptyCollectionOf(AccessibilityAction.class));
+ assertThat(unparceledNode.getText(), equalTo(text));
+ }
}
diff --git a/core/tests/coretests/src/com/android/internal/os/KernelUidCpuActiveTimeReaderTest.java b/core/tests/coretests/src/com/android/internal/os/KernelUidCpuActiveTimeReaderTest.java
index 312af16..06f51c9 100644
--- a/core/tests/coretests/src/com/android/internal/os/KernelUidCpuActiveTimeReaderTest.java
+++ b/core/tests/coretests/src/com/android/internal/os/KernelUidCpuActiveTimeReaderTest.java
@@ -104,6 +104,30 @@
}
@Test
+ public void testReadAbsolute() throws Exception {
+ final int cores = 8;
+ final int[] uids = {1, 22, 333, 4444, 5555};
+
+ final long[][] times = increaseTime(new long[uids.length][cores]);
+ when(mProcReader.readBytes()).thenReturn(getUidTimesBytes(uids, times));
+ mReader.readAbsolute(mCallback);
+ for (int i = 0; i < uids.length; i++) {
+ verify(mCallback).onUidCpuActiveTime(uids[i], getTotal(times[i]));
+ }
+ verifyNoMoreInteractions(mCallback);
+
+ // Verify that a second call still returns absolute values
+ Mockito.reset(mCallback);
+ final long[][] times1 = increaseTime(times);
+ when(mProcReader.readBytes()).thenReturn(getUidTimesBytes(uids, times1));
+ mReader.readAbsolute(mCallback);
+ for (int i = 0; i < uids.length; i++) {
+ verify(mCallback).onUidCpuActiveTime(uids[i], getTotal(times1[i]));
+ }
+ verifyNoMoreInteractions(mCallback);
+ }
+
+ @Test
public void testReadDelta_malformedData() throws Exception {
final int cores = 8;
final int[] uids = {1, 22, 333, 4444, 5555};
diff --git a/core/tests/coretests/src/com/android/internal/os/KernelUidCpuClusterTimeReaderTest.java b/core/tests/coretests/src/com/android/internal/os/KernelUidCpuClusterTimeReaderTest.java
index d21f541..85dce02 100644
--- a/core/tests/coretests/src/com/android/internal/os/KernelUidCpuClusterTimeReaderTest.java
+++ b/core/tests/coretests/src/com/android/internal/os/KernelUidCpuClusterTimeReaderTest.java
@@ -114,6 +114,34 @@
}
@Test
+ public void testReadAbsolute() throws Exception {
+ VerifiableCallback cb = new VerifiableCallback();
+ final int cores = 6;
+ final int[] clusters = {2, 4};
+ final int[] uids = {1, 22, 333, 4444, 5555};
+
+ // Verify return absolute value
+ final long[][] times = increaseTime(new long[uids.length][cores]);
+ when(mProcReader.readBytes()).thenReturn(getUidTimesBytes(uids, clusters, times));
+ mReader.readAbsolute(cb);
+ for (int i = 0; i < uids.length; i++) {
+ cb.verify(uids[i], getTotal(clusters, times[i]));
+ }
+ cb.verifyNoMoreInteractions();
+
+ // Verify that a second call should return the same absolute value
+ cb.clear();
+ Mockito.reset(mProcReader);
+ final long[][] times1 = increaseTime(times);
+ when(mProcReader.readBytes()).thenReturn(getUidTimesBytes(uids, clusters, times1));
+ mReader.readAbsolute(cb);
+ for (int i = 0; i < uids.length; i++) {
+ cb.verify(uids[i], getTotal(clusters, times1[i]));
+ }
+ cb.verifyNoMoreInteractions();
+ }
+
+ @Test
public void testReadDelta_malformedData() throws Exception {
final int cores = 6;
final int[] clusters = {2, 4};
diff --git a/core/tests/coretests/src/com/android/internal/os/KernelUidCpuFreqTimeReaderTest.java b/core/tests/coretests/src/com/android/internal/os/KernelUidCpuFreqTimeReaderTest.java
index 0950721..a6b99c3 100644
--- a/core/tests/coretests/src/com/android/internal/os/KernelUidCpuFreqTimeReaderTest.java
+++ b/core/tests/coretests/src/com/android/internal/os/KernelUidCpuFreqTimeReaderTest.java
@@ -297,6 +297,46 @@
}
@Test
+ public void testReadAbsolute() throws Exception {
+ VerifiableCallback cb = new VerifiableCallback();
+ final long[] freqs = {110, 123, 145, 167, 289, 997};
+ final int[] uids = {1, 22, 333, 444, 555};
+ final long[][] times = new long[uids.length][freqs.length];
+ for (int i = 0; i < uids.length; ++i) {
+ for (int j = 0; j < freqs.length; ++j) {
+ times[i][j] = uids[i] * freqs[j] * 10;
+ }
+ }
+ when(mBufferedReader.readLine()).thenReturn(getFreqsLine(freqs));
+ long[] actualFreqs = mKernelUidCpuFreqTimeReader.readFreqs(mBufferedReader, mPowerProfile);
+
+ assertArrayEquals(freqs, actualFreqs);
+ // Verify that the absolute values are returned
+ when(mProcReader.readBytes()).thenReturn(getUidTimesBytes(uids, times));
+ mKernelUidCpuFreqTimeReader.readAbsolute(cb);
+ for (int i = 0; i < uids.length; ++i) {
+ cb.verify(uids[i], times[i]);
+ }
+ cb.verifyNoMoreInteractions();
+
+ // Verify that a second call should still return absolute values
+ cb.clear();
+ Mockito.reset(mProcReader);
+ final long[][] newTimes1 = new long[uids.length][freqs.length];
+ for (int i = 0; i < uids.length; ++i) {
+ for (int j = 0; j < freqs.length; ++j) {
+ newTimes1[i][j] = times[i][j] + (uids[i] + freqs[j]) * 50;
+ }
+ }
+ when(mProcReader.readBytes()).thenReturn(getUidTimesBytes(uids, newTimes1));
+ mKernelUidCpuFreqTimeReader.readAbsolute(cb);
+ for (int i = 0; i < uids.length; ++i) {
+ cb.verify(uids[i], newTimes1[i]);
+ }
+ cb.verifyNoMoreInteractions();
+ }
+
+ @Test
public void testReadDelta_malformedData() throws Exception {
final long[] freqs = {1, 12, 123, 1234, 12345, 123456};
final int[] uids = {1, 22, 333, 4444, 5555};
diff --git a/graphics/java/android/graphics/drawable/AdaptiveIconDrawable.java b/graphics/java/android/graphics/drawable/AdaptiveIconDrawable.java
index 1d0cfa5..fdd638a 100644
--- a/graphics/java/android/graphics/drawable/AdaptiveIconDrawable.java
+++ b/graphics/java/android/graphics/drawable/AdaptiveIconDrawable.java
@@ -44,6 +44,7 @@
import android.util.PathParser;
import com.android.internal.R;
+
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@@ -668,13 +669,7 @@
@Override
public void setAlpha(int alpha) {
- final ChildDrawable[] array = mLayerState.mChildren;
- for (int i = 0; i < mLayerState.N_CHILDREN; i++) {
- final Drawable dr = array[i].mDrawable;
- if (dr != null) {
- dr.setAlpha(alpha);
- }
- }
+ mPaint.setAlpha(alpha);
}
@Override
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 3b080cf..e1117f5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
@@ -117,7 +117,7 @@
private KeyButtonDrawable mImeIcon;
private KeyButtonDrawable mMenuIcon;
private KeyButtonDrawable mAccessibilityIcon;
- private KeyButtonDrawable mRotateSuggestionIcon;
+ private TintedKeyButtonDrawable mRotateSuggestionIcon;
private GestureHelper mGestureHelper;
private DeadZone mDeadZone;
@@ -479,7 +479,7 @@
darkContext.getDrawable(darkIcon));
}
- private KeyButtonDrawable getDrawable(Context ctx, @DrawableRes int icon,
+ private TintedKeyButtonDrawable getDrawable(Context ctx, @DrawableRes int icon,
@ColorInt int lightColor, @ColorInt int darkColor) {
return TintedKeyButtonDrawable.create(ctx.getDrawable(icon), lightColor, darkColor);
}
@@ -745,8 +745,15 @@
Context rotateContext = new ContextThemeWrapper(ctx, style);
// Recreate the icon and set it if needed
+ TintedKeyButtonDrawable priorIcon = mRotateSuggestionIcon;
mRotateSuggestionIcon = getDrawable(rotateContext, R.drawable.ic_sysbar_rotate_button,
lightColor, darkColor);
+
+ // Apply any prior set dark intensity
+ if (priorIcon != null && priorIcon.isDarkIntensitySet()) {
+ mRotateSuggestionIcon.setDarkIntensity(priorIcon.getDarkIntensity());
+ }
+
if (setIcon) getRotateSuggestionButton().setImageDrawable(mRotateSuggestionIcon);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/TintedKeyButtonDrawable.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/TintedKeyButtonDrawable.java
index acf9c00..56f6726 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/TintedKeyButtonDrawable.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/TintedKeyButtonDrawable.java
@@ -30,6 +30,9 @@
private final int mLightColor;
private final int mDarkColor;
+ public static final float DARK_INTENSITY_NOT_SET = -1f;
+ private float mDarkIntensity = DARK_INTENSITY_NOT_SET;
+
public static TintedKeyButtonDrawable create(Drawable drawable, @ColorInt int lightColor,
@ColorInt int darkColor) {
return new TintedKeyButtonDrawable(new Drawable[] { drawable }, lightColor, darkColor);
@@ -39,11 +42,13 @@
super(drawables);
mLightColor = lightColor;
mDarkColor = darkColor;
+ setDarkIntensity(0f); // Set initial coloration
}
@Override
public void setDarkIntensity(float intensity) {
// Duplicate intensity scaling from KeyButtonDrawable
+ mDarkIntensity = intensity;
int intermediateColor = ColorUtils.compositeColors(
setAlphaFloat(mDarkColor, intensity),
setAlphaFloat(mLightColor,1f - intensity));
@@ -52,6 +57,16 @@
}
private int setAlphaFloat(int color, float alpha) {
- return ColorUtils.setAlphaComponent(color, (int) (alpha * 255f));
+ // Ensure alpha is clamped [0-255] or ColorUtils will crash
+ final int alphaInt = alpha > 1f ? 255 : (alpha < 0f ? 0 : ((int) alpha*255));
+ return ColorUtils.setAlphaComponent(color, alphaInt);
+ }
+
+ public boolean isDarkIntensitySet() {
+ return mDarkIntensity == DARK_INTENSITY_NOT_SET;
+ }
+
+ public float getDarkIntensity() {
+ return mDarkIntensity;
}
}
diff --git a/services/core/java/com/android/server/AlarmManagerService.java b/services/core/java/com/android/server/AlarmManagerService.java
index d066056..8ce4e64 100644
--- a/services/core/java/com/android/server/AlarmManagerService.java
+++ b/services/core/java/com/android/server/AlarmManagerService.java
@@ -1868,6 +1868,7 @@
final long nowRTC = System.currentTimeMillis();
final long nowELAPSED = SystemClock.elapsedRealtime();
+ final long nowUPTIME = SystemClock.uptimeMillis();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
pw.print(" nowRTC="); pw.print(nowRTC);
@@ -1883,6 +1884,25 @@
pw.print(" mLastTickSet="); pw.println(sdf.format(new Date(mLastTickSet)));
pw.print(" mLastTickAdded="); pw.println(sdf.format(new Date(mLastTickAdded)));
pw.print(" mLastTickRemoved="); pw.println(sdf.format(new Date(mLastTickRemoved)));
+
+ SystemServiceManager ssm = LocalServices.getService(SystemServiceManager.class);
+ if (ssm != null) {
+ pw.println();
+ pw.print(" RuntimeStarted=");
+ pw.print(sdf.format(
+ new Date(nowRTC - nowELAPSED + ssm.getRuntimeStartElapsedTime())));
+ if (ssm.isRuntimeRestarted()) {
+ pw.print(" (Runtime restarted)");
+ }
+ pw.println();
+ pw.print(" Runtime uptime (elapsed): ");
+ TimeUtils.formatDuration(nowELAPSED, ssm.getRuntimeStartElapsedTime(), pw);
+ pw.println();
+ pw.print(" Runtime uptime (uptime): ");
+ TimeUtils.formatDuration(nowUPTIME, ssm.getRuntimeStartUptime(), pw);
+ pw.println();
+ }
+
pw.println();
if (!mInteractive) {
pw.print(" Time since non-interactive: ");
diff --git a/services/core/java/com/android/server/SystemServiceManager.java b/services/core/java/com/android/server/SystemServiceManager.java
index 581914d..63584d9 100644
--- a/services/core/java/com/android/server/SystemServiceManager.java
+++ b/services/core/java/com/android/server/SystemServiceManager.java
@@ -39,6 +39,8 @@
private final Context mContext;
private boolean mSafeMode;
private boolean mRuntimeRestarted;
+ private long mRuntimeStartElapsedTime;
+ private long mRuntimeStartUptime;
// Services that should receive lifecycle events.
private final ArrayList<SystemService> mServices = new ArrayList<SystemService>();
@@ -287,8 +289,25 @@
return mRuntimeRestarted;
}
- void setRuntimeRestarted(boolean runtimeRestarted) {
+ /**
+ * @return Time when SystemServer was started, in elapsed realtime.
+ */
+ public long getRuntimeStartElapsedTime() {
+ return mRuntimeStartElapsedTime;
+ }
+
+ /**
+ * @return Time when SystemServer was started, in uptime.
+ */
+ public long getRuntimeStartUptime() {
+ return mRuntimeStartUptime;
+ }
+
+ void setStartInfo(boolean runtimeRestarted,
+ long runtimeStartElapsedTime, long runtimeStartUptime) {
mRuntimeRestarted = runtimeRestarted;
+ mRuntimeStartElapsedTime = runtimeStartElapsedTime;
+ mRuntimeStartUptime = runtimeStartUptime;
}
private void warnIfTooLong(long duration, SystemService service, String operation) {
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index f4a4af2..666f3a2 100644
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -347,6 +347,9 @@
private final Rect mTmpRect2 = new Rect();
private final ActivityOptions mTmpOptions = ActivityOptions.makeBasic();
+ /** List for processing through a set of activities */
+ private final ArrayList<ActivityRecord> mTmpActivities = new ArrayList<>();
+
/** Run all ActivityStacks through this */
protected final ActivityStackSupervisor mStackSupervisor;
@@ -4405,11 +4408,15 @@
"Removing app " + app + " from history with " + i + " entries");
for (int taskNdx = mTaskHistory.size() - 1; taskNdx >= 0; --taskNdx) {
final ArrayList<ActivityRecord> activities = mTaskHistory.get(taskNdx).mActivities;
- for (int activityNdx = activities.size() - 1; activityNdx >= 0; --activityNdx) {
- final ActivityRecord r = activities.get(activityNdx);
- --i;
+ mTmpActivities.clear();
+ mTmpActivities.addAll(activities);
+
+ while (!mTmpActivities.isEmpty()) {
+ final int targetIndex = mTmpActivities.size() - 1;
+ final ActivityRecord r = mTmpActivities.remove(targetIndex);
if (DEBUG_CLEANUP) Slog.v(TAG_CLEANUP,
- "Record #" + i + " " + r + ": app=" + r.app);
+ "Record #" + targetIndex + " " + r + ": app=" + r.app);
+
if (r.app == app) {
if (r.visible) {
hasVisibleActivities = true;
@@ -4827,9 +4834,11 @@
ComponentName homeActivity = null;
for (int taskNdx = mTaskHistory.size() - 1; taskNdx >= 0; --taskNdx) {
final ArrayList<ActivityRecord> activities = mTaskHistory.get(taskNdx).mActivities;
- int numActivities = activities.size();
- for (int activityNdx = 0; activityNdx < numActivities; ++activityNdx) {
- ActivityRecord r = activities.get(activityNdx);
+ mTmpActivities.clear();
+ mTmpActivities.addAll(activities);
+
+ while (!mTmpActivities.isEmpty()) {
+ ActivityRecord r = mTmpActivities.remove(0);
final boolean sameComponent =
(r.packageName.equals(packageName) && (filterByClasses == null
|| filterByClasses.contains(r.realActivity.getClassName())))
@@ -4862,12 +4871,8 @@
r.app = null;
}
lastTask = r.getTask();
- if (finishActivityLocked(r, Activity.RESULT_CANCELED, null, "force-stop",
- true)) {
- // r has been deleted from mActivities, accommodate.
- --numActivities;
- --activityNdx;
- }
+ finishActivityLocked(r, Activity.RESULT_CANCELED, null, "force-stop",
+ true);
}
}
}
diff --git a/services/core/java/com/android/server/am/TaskRecord.java b/services/core/java/com/android/server/am/TaskRecord.java
index 6f6e0d9..8174f40 100644
--- a/services/core/java/com/android/server/am/TaskRecord.java
+++ b/services/core/java/com/android/server/am/TaskRecord.java
@@ -2002,7 +2002,7 @@
} else if (intent != null) {
sb.append(" I=");
sb.append(intent.getComponent().flattenToShortString());
- } else if (affinityIntent != null) {
+ } else if (affinityIntent != null && affinityIntent.getComponent() != null) {
sb.append(" aI=");
sb.append(affinityIntent.getComponent().flattenToShortString());
} else {
diff --git a/services/core/java/com/android/server/broadcastradio/hal2/Convert.java b/services/core/java/com/android/server/broadcastradio/hal2/Convert.java
index 5af19ec..6919282 100644
--- a/services/core/java/com/android/server/broadcastradio/hal2/Convert.java
+++ b/services/core/java/com/android/server/broadcastradio/hal2/Convert.java
@@ -23,6 +23,8 @@
import android.hardware.broadcastradio.V2_0.Announcement;
import android.hardware.broadcastradio.V2_0.DabTableEntry;
import android.hardware.broadcastradio.V2_0.IdentifierType;
+import android.hardware.broadcastradio.V2_0.Metadata;
+import android.hardware.broadcastradio.V2_0.MetadataKey;
import android.hardware.broadcastradio.V2_0.ProgramFilter;
import android.hardware.broadcastradio.V2_0.ProgramIdentifier;
import android.hardware.broadcastradio.V2_0.ProgramInfo;
@@ -34,6 +36,7 @@
import android.hardware.radio.ProgramList;
import android.hardware.radio.ProgramSelector;
import android.hardware.radio.RadioManager;
+import android.hardware.radio.RadioMetadata;
import android.os.ParcelableException;
import android.util.Slog;
@@ -283,6 +286,77 @@
secondaryIds, null);
}
+ private enum MetadataType {
+ INT, STRING
+ }
+
+ private static class MetadataDef {
+ private MetadataType type;
+ private String key;
+ private MetadataDef(MetadataType type, String key) {
+ this.type = type;
+ this.key = key;
+ }
+ }
+
+ private static final Map<Integer, MetadataDef> metadataKeys;
+ static {
+ metadataKeys = new HashMap<>();
+ metadataKeys.put(MetadataKey.RDS_PS, new MetadataDef(
+ MetadataType.STRING, RadioMetadata.METADATA_KEY_RDS_PS));
+ metadataKeys.put(MetadataKey.RDS_PTY, new MetadataDef(
+ MetadataType.INT, RadioMetadata.METADATA_KEY_RDS_PTY));
+ metadataKeys.put(MetadataKey.RBDS_PTY, new MetadataDef(
+ MetadataType.INT, RadioMetadata.METADATA_KEY_RBDS_PTY));
+ metadataKeys.put(MetadataKey.RDS_RT, new MetadataDef(
+ MetadataType.STRING, RadioMetadata.METADATA_KEY_RDS_RT));
+ metadataKeys.put(MetadataKey.SONG_TITLE, new MetadataDef(
+ MetadataType.STRING, RadioMetadata.METADATA_KEY_TITLE));
+ metadataKeys.put(MetadataKey.SONG_ARTIST, new MetadataDef(
+ MetadataType.STRING, RadioMetadata.METADATA_KEY_ARTIST));
+ metadataKeys.put(MetadataKey.SONG_ALBUM, new MetadataDef(
+ MetadataType.STRING, RadioMetadata.METADATA_KEY_ALBUM));
+ metadataKeys.put(MetadataKey.STATION_ICON, new MetadataDef(
+ MetadataType.INT, RadioMetadata.METADATA_KEY_ICON));
+ metadataKeys.put(MetadataKey.ALBUM_ART, new MetadataDef(
+ MetadataType.INT, RadioMetadata.METADATA_KEY_ART));
+ metadataKeys.put(MetadataKey.PROGRAM_NAME, new MetadataDef(
+ MetadataType.STRING, RadioMetadata.METADATA_KEY_PROGRAM_NAME));
+ metadataKeys.put(MetadataKey.DAB_ENSEMBLE_NAME, new MetadataDef(
+ MetadataType.STRING, RadioMetadata.METADATA_KEY_DAB_ENSEMBLE_NAME));
+ metadataKeys.put(MetadataKey.DAB_ENSEMBLE_NAME_SHORT, new MetadataDef(
+ MetadataType.STRING, RadioMetadata.METADATA_KEY_DAB_ENSEMBLE_NAME_SHORT));
+ metadataKeys.put(MetadataKey.DAB_SERVICE_NAME, new MetadataDef(
+ MetadataType.STRING, RadioMetadata.METADATA_KEY_DAB_SERVICE_NAME));
+ metadataKeys.put(MetadataKey.DAB_SERVICE_NAME_SHORT, new MetadataDef(
+ MetadataType.STRING, RadioMetadata.METADATA_KEY_DAB_SERVICE_NAME_SHORT));
+ metadataKeys.put(MetadataKey.DAB_COMPONENT_NAME, new MetadataDef(
+ MetadataType.STRING, RadioMetadata.METADATA_KEY_DAB_COMPONENT_NAME));
+ metadataKeys.put(MetadataKey.DAB_COMPONENT_NAME_SHORT, new MetadataDef(
+ MetadataType.STRING, RadioMetadata.METADATA_KEY_DAB_COMPONENT_NAME_SHORT));
+ }
+
+ private static @NonNull RadioMetadata metadataFromHal(@NonNull ArrayList<Metadata> meta) {
+ RadioMetadata.Builder builder = new RadioMetadata.Builder();
+
+ for (Metadata entry : meta) {
+ MetadataDef keyDef = metadataKeys.get(entry.key);
+ if (keyDef == null) {
+ Slog.i(TAG, "Ignored unknown metadata entry: " + MetadataKey.toString(entry.key));
+ continue;
+ }
+ if (keyDef.type == MetadataType.STRING) {
+ builder.putString(keyDef.key, entry.stringValue);
+ } else { // MetadataType.INT
+ /* Current java API use 32-bit values for int metadata,
+ * but we might change it in the future */
+ builder.putInt(keyDef.key, (int)entry.intValue);
+ }
+ }
+
+ return builder.build();
+ }
+
static @NonNull RadioManager.ProgramInfo programInfoFromHal(@NonNull ProgramInfo info) {
Collection<ProgramSelector.Identifier> relatedContent = info.relatedContent.stream().
map(id -> Objects.requireNonNull(programIdentifierFromHal(id))).
@@ -295,7 +369,7 @@
relatedContent,
info.infoFlags,
info.signalQuality,
- null, // TODO(b/69860743): metadata
+ metadataFromHal(info.metadata),
vendorInfoFromHal(info.vendorInfo)
);
}
diff --git a/services/core/java/com/android/server/locksettings/LockSettingsService.java b/services/core/java/com/android/server/locksettings/LockSettingsService.java
index a572cdf..468ec59 100644
--- a/services/core/java/com/android/server/locksettings/LockSettingsService.java
+++ b/services/core/java/com/android/server/locksettings/LockSettingsService.java
@@ -2098,7 +2098,6 @@
private static final String[] VALID_SETTINGS = new String[] {
LockPatternUtils.LOCKOUT_PERMANENT_KEY,
- LockPatternUtils.LOCKOUT_ATTEMPT_DEADLINE,
LockPatternUtils.PATTERN_EVER_CHOSEN_KEY,
LockPatternUtils.PASSWORD_TYPE_KEY,
LockPatternUtils.PASSWORD_TYPE_ALTERNATE_KEY,
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index f12795b..fdba99e 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -2980,6 +2980,9 @@
}
}
}
+ // Adjust seInfo to ensure apps which share a sharedUserId are placed in the same
+ // SELinux domain.
+ setting.fixSeInfoLocked();
}
// Now that we know all the packages we are keeping,
@@ -10376,20 +10379,24 @@
pkg.applicationInfo.flags |= ApplicationInfo.FLAG_UPDATED_SYSTEM_APP;
}
- // SELinux sandboxes become more restrictive as targetSdkVersion increases.
- // To ensure that apps with sharedUserId are placed in the same selinux domain
- // without breaking any assumptions about access, put them into the least
- // restrictive targetSdkVersion=25 domain.
- // TODO(b/72290969): Base this on the actual targetSdkVersion(s) of the apps within the
- // sharedUserSetting, instead of defaulting to the least restrictive domain.
- final int targetSdk = (sharedUserSetting != null) ? 25
- : pkg.applicationInfo.targetSdkVersion;
+ // Apps which share a sharedUserId must be placed in the same selinux domain. If this
+ // package is the first app installed as this shared user, set seInfoTargetSdkVersion to its
+ // targetSdkVersion. These are later adjusted in PackageManagerService's constructor to be
+ // the lowest targetSdkVersion of all apps within the shared user, which corresponds to the
+ // least restrictive selinux domain.
+ // NOTE: As new packages are installed / updated, the shared user's seinfoTargetSdkVersion
+ // will NOT be modified until next boot, even if a lower targetSdkVersion is used. This
+ // ensures that all packages continue to run in the same selinux domain.
+ final int targetSdkVersion =
+ ((sharedUserSetting != null) && (sharedUserSetting.packages.size() != 0)) ?
+ sharedUserSetting.seInfoTargetSdkVersion : pkg.applicationInfo.targetSdkVersion;
// TODO(b/71593002): isPrivileged for sharedUser and appInfo should never be out of sync.
// They currently can be if the sharedUser apps are signed with the platform key.
final boolean isPrivileged = (sharedUserSetting != null) ?
sharedUserSetting.isPrivileged() | pkg.isPrivileged() : pkg.isPrivileged();
- SELinuxMMAC.assignSeInfoValue(pkg, isPrivileged, targetSdk);
+ pkg.applicationInfo.seInfo = SELinuxMMAC.getSeInfo(pkg, isPrivileged,
+ pkg.applicationInfo.targetSandboxVersion, targetSdkVersion);
pkg.mExtras = pkgSetting;
pkg.applicationInfo.processName = fixProcessName(
diff --git a/services/core/java/com/android/server/pm/SELinuxMMAC.java b/services/core/java/com/android/server/pm/SELinuxMMAC.java
index a9f1528..b47d966 100644
--- a/services/core/java/com/android/server/pm/SELinuxMMAC.java
+++ b/services/core/java/com/android/server/pm/SELinuxMMAC.java
@@ -64,6 +64,8 @@
/** Required MAC permissions files */
private static List<File> sMacPermissions = new ArrayList<>();
+ private static final String DEFAULT_SEINFO = "default";
+
// Append privapp to existing seinfo label
private static final String PRIVILEGED_APP_STR = ":privapp";
@@ -307,45 +309,56 @@
}
/**
- * Applies a security label to a package based on an seinfo tag taken from a matched
- * policy. All signature based policy stanzas are consulted and, if no match is
- * found, the default seinfo label of 'default' (set in ApplicationInfo object) is
- * used. The security label is attached to the ApplicationInfo instance of the package
- * in the event that a matching policy was found.
+ * Selects a security label to a package based on input parameters and the seinfo tag taken
+ * from a matched policy. All signature based policy stanzas are consulted and, if no match
+ * is found, the default seinfo label of 'default' is used. The security label is attached to
+ * the ApplicationInfo instance of the package.
*
* @param pkg object representing the package to be labeled.
+ * @param isPrivileged boolean.
+ * @param targetSandboxVersion int.
+ * @param targetSdkVersion int. If this pkg runs as a sharedUser, targetSdkVersion is the
+ * greater of: lowest targetSdk for all pkgs in the sharedUser, or
+ * MINIMUM_TARGETSDKVERSION.
+ * @return String representing the resulting seinfo.
*/
- public static void assignSeInfoValue(PackageParser.Package pkg, boolean isPrivileged,
- int targetSdkVersion) {
+ public static String getSeInfo(PackageParser.Package pkg, boolean isPrivileged,
+ int targetSandboxVersion, int targetSdkVersion) {
+ String seInfo = null;
synchronized (sPolicies) {
if (!sPolicyRead) {
if (DEBUG_POLICY) {
Slog.d(TAG, "Policy not read");
}
- return;
- }
- for (Policy policy : sPolicies) {
- String seInfo = policy.getMatchedSeInfo(pkg);
- if (seInfo != null) {
- pkg.applicationInfo.seInfo = seInfo;
- break;
+ } else {
+ for (Policy policy : sPolicies) {
+ seInfo = policy.getMatchedSeInfo(pkg);
+ if (seInfo != null) {
+ break;
+ }
}
}
}
- if (pkg.applicationInfo.targetSandboxVersion == 2)
- pkg.applicationInfo.seInfo += SANDBOX_V2_STR;
-
- if (isPrivileged) {
- pkg.applicationInfo.seInfo += PRIVILEGED_APP_STR;
+ if (seInfo == null) {
+ seInfo = DEFAULT_SEINFO;
}
- pkg.applicationInfo.seInfo += TARGETSDKVERSION_STR + targetSdkVersion;
+ if (targetSandboxVersion == 2) {
+ seInfo += SANDBOX_V2_STR;
+ }
+
+ if (isPrivileged) {
+ seInfo += PRIVILEGED_APP_STR;
+ }
+
+ seInfo += TARGETSDKVERSION_STR + targetSdkVersion;
if (DEBUG_POLICY_INSTALL) {
Slog.i(TAG, "package (" + pkg.packageName + ") labeled with " +
- "seinfo=" + pkg.applicationInfo.seInfo);
+ "seinfo=" + seInfo);
}
+ return seInfo;
}
}
diff --git a/services/core/java/com/android/server/pm/SharedUserSetting.java b/services/core/java/com/android/server/pm/SharedUserSetting.java
index 2446131..1d9afd9 100644
--- a/services/core/java/com/android/server/pm/SharedUserSetting.java
+++ b/services/core/java/com/android/server/pm/SharedUserSetting.java
@@ -39,6 +39,10 @@
int uidFlags;
int uidPrivateFlags;
+ // The lowest targetSdkVersion of all apps in the sharedUserSetting, used to assign seinfo so
+ // that all apps within the sharedUser run in the same selinux context.
+ int seInfoTargetSdkVersion;
+
final ArraySet<PackageSetting> packages = new ArraySet<PackageSetting>();
final PackageSignatures signatures = new PackageSignatures();
@@ -84,6 +88,11 @@
}
void addPackage(PackageSetting packageSetting) {
+ // If this is the first package added to this shared user, temporarily (until next boot) use
+ // its targetSdkVersion when assigning seInfo for the shared user.
+ if ((packages.size() == 0) && (packageSetting.pkg != null)) {
+ seInfoTargetSdkVersion = packageSetting.pkg.applicationInfo.targetSdkVersion;
+ }
if (packages.add(packageSetting)) {
setFlags(this.pkgFlags | packageSetting.pkgFlags);
setPrivateFlags(this.pkgPrivateFlags | packageSetting.pkgPrivateFlags);
@@ -107,4 +116,26 @@
public boolean isPrivileged() {
return (this.pkgPrivateFlags & ApplicationInfo.PRIVATE_FLAG_PRIVILEGED) != 0;
}
+
+ /**
+ * Determine the targetSdkVersion for a sharedUser and update pkg.applicationInfo.seInfo
+ * to ensure that all apps within the sharedUser share an SELinux domain. Use the lowest
+ * targetSdkVersion of all apps within the shared user, which corresponds to the least
+ * restrictive selinux domain.
+ */
+ public void fixSeInfoLocked() {
+ final List<PackageParser.Package> pkgList = getPackages();
+
+ for (PackageParser.Package pkg : pkgList) {
+ if (pkg.applicationInfo.targetSdkVersion < seInfoTargetSdkVersion) {
+ seInfoTargetSdkVersion = pkg.applicationInfo.targetSdkVersion;
+ }
+ }
+ for (PackageParser.Package pkg : pkgList) {
+ final boolean isPrivileged = isPrivileged() | pkg.isPrivileged();
+ pkg.applicationInfo.seInfo = SELinuxMMAC.getSeInfo(pkg, isPrivileged,
+ pkg.applicationInfo.targetSandboxVersion, seInfoTargetSdkVersion);
+ }
+ }
+
}
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index ab0779b..8bc9830 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -4389,13 +4389,13 @@
@Override
// TODO: Should probably be moved into DisplayFrames.
- public boolean getInsetHintLw(WindowManager.LayoutParams attrs, Rect taskBounds,
- DisplayFrames displayFrames, Rect outContentInsets, Rect outStableInsets,
+ public boolean getLayoutHintLw(WindowManager.LayoutParams attrs, Rect taskBounds,
+ DisplayFrames displayFrames, Rect outFrame, Rect outContentInsets, Rect outStableInsets,
Rect outOutsets, DisplayCutout.ParcelableWrapper outDisplayCutout) {
final int fl = PolicyControl.getWindowFlags(null, attrs);
final int pfl = attrs.privateFlags;
- final int sysuiVis = PolicyControl.getSystemUiVisibility(null, attrs);
- final int systemUiVisibility = (sysuiVis | attrs.subtreeSystemUiVisibility);
+ final int requestedSysUiVis = PolicyControl.getSystemUiVisibility(null, attrs);
+ final int sysUiVis = requestedSysUiVis | getImpliedSysUiFlagsForLayout(attrs);
final int displayRotation = displayFrames.mRotation;
final int displayWidth = displayFrames.mDisplayWidth;
final int displayHeight = displayFrames.mDisplayHeight;
@@ -4416,21 +4416,20 @@
}
}
- final boolean layoutInScreenAndInsetDecor =
- (fl & (FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR))
- == (FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR);
+ final boolean layoutInScreen = (fl & FLAG_LAYOUT_IN_SCREEN) != 0;
+ final boolean layoutInScreenAndInsetDecor = layoutInScreen &&
+ (fl & FLAG_LAYOUT_INSET_DECOR) != 0;
final boolean screenDecor = (pfl & PRIVATE_FLAG_IS_SCREEN_DECOR) != 0;
if (layoutInScreenAndInsetDecor && !screenDecor) {
- Rect frame;
int availRight, availBottom;
if (canHideNavigationBar() &&
- (systemUiVisibility & View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) != 0) {
- frame = displayFrames.mUnrestricted;
+ (sysUiVis & View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) != 0) {
+ outFrame.set(displayFrames.mUnrestricted);
availRight = displayFrames.mUnrestricted.right;
availBottom = displayFrames.mUnrestricted.bottom;
} else {
- frame = displayFrames.mRestricted;
+ outFrame.set(displayFrames.mRestricted);
availRight = displayFrames.mRestricted.right;
availBottom = displayFrames.mRestricted.bottom;
}
@@ -4438,7 +4437,7 @@
availRight - displayFrames.mStable.right,
availBottom - displayFrames.mStable.bottom);
- if ((systemUiVisibility & View.SYSTEM_UI_FLAG_LAYOUT_STABLE) != 0) {
+ if ((sysUiVis & View.SYSTEM_UI_FLAG_LAYOUT_STABLE) != 0) {
if ((fl & FLAG_FULLSCREEN) != 0) {
outContentInsets.set(displayFrames.mStableFullscreen.left,
displayFrames.mStableFullscreen.top,
@@ -4460,14 +4459,25 @@
displayWidth, displayHeight);
calculateRelevantTaskInsets(taskBounds, outStableInsets,
displayWidth, displayHeight);
+ outFrame.intersect(taskBounds);
}
- outDisplayCutout.set(displayFrames.mDisplayCutout.calculateRelativeTo(frame));
+ outDisplayCutout.set(displayFrames.mDisplayCutout.calculateRelativeTo(outFrame));
+ return mForceShowSystemBars;
+ } else {
+ if (layoutInScreen) {
+ outFrame.set(displayFrames.mUnrestricted);
+ } else {
+ outFrame.set(displayFrames.mStable);
+ }
+ if (taskBounds != null) {
+ outFrame.intersect(taskBounds);
+ }
+
+ outContentInsets.setEmpty();
+ outStableInsets.setEmpty();
+ outDisplayCutout.set(DisplayCutout.NO_CUTOUT);
return mForceShowSystemBars;
}
- outContentInsets.setEmpty();
- outStableInsets.setEmpty();
- outDisplayCutout.set(DisplayCutout.NO_CUTOUT);
- return mForceShowSystemBars;
}
/**
diff --git a/services/core/java/com/android/server/policy/WindowManagerPolicy.java b/services/core/java/com/android/server/policy/WindowManagerPolicy.java
index ab331a5..d5c12f7 100644
--- a/services/core/java/com/android/server/policy/WindowManagerPolicy.java
+++ b/services/core/java/com/android/server/policy/WindowManagerPolicy.java
@@ -1145,13 +1145,14 @@
/**
- * Return the insets for the areas covered by system windows. These values are computed on the
+ * Return the layout hints for a newly added window. These values are computed on the
* most recent layout, so they are not guaranteed to be correct.
*
* @param attrs The LayoutParams of the window.
* @param taskBounds The bounds of the task this window is on or {@code null} if no task is
* associated with the window.
* @param displayFrames display frames.
+ * @param outFrame The frame of the window.
* @param outContentInsets The areas covered by system windows, expressed as positive insets.
* @param outStableInsets The areas covered by stable system windows irrespective of their
* current visibility. Expressed as positive insets.
@@ -1160,9 +1161,10 @@
* @return Whether to always consume the navigation bar.
* See {@link #isNavBarForcedShownLw(WindowState)}.
*/
- default boolean getInsetHintLw(WindowManager.LayoutParams attrs, Rect taskBounds,
- DisplayFrames displayFrames, Rect outContentInsets, Rect outStableInsets,
- Rect outOutsets, DisplayCutout.ParcelableWrapper outDisplayCutout) {
+ default boolean getLayoutHintLw(WindowManager.LayoutParams attrs, Rect taskBounds,
+ DisplayFrames displayFrames, Rect outFrame, Rect outContentInsets,
+ Rect outStableInsets, Rect outOutsets,
+ DisplayCutout.ParcelableWrapper outDisplayCutout) {
return false;
}
diff --git a/services/core/java/com/android/server/stats/StatsCompanionService.java b/services/core/java/com/android/server/stats/StatsCompanionService.java
index 6e017cd..64a2570 100644
--- a/services/core/java/com/android/server/stats/StatsCompanionService.java
+++ b/services/core/java/com/android/server/stats/StatsCompanionService.java
@@ -61,12 +61,17 @@
import com.android.internal.annotations.GuardedBy;
import com.android.internal.net.NetworkStatsFactory;
import com.android.internal.os.KernelCpuSpeedReader;
+import com.android.internal.os.KernelUidCpuTimeReader;
+import com.android.internal.os.KernelUidCpuClusterTimeReader;
+import com.android.internal.os.KernelUidCpuActiveTimeReader;
+import com.android.internal.os.KernelUidCpuFreqTimeReader;
import com.android.internal.os.KernelWakelockReader;
import com.android.internal.os.KernelWakelockStats;
import com.android.internal.os.PowerProfile;
import com.android.server.LocalServices;
import com.android.server.SystemService;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -106,7 +111,6 @@
private final ShutdownEventReceiver mShutdownEventReceiver;
private final KernelWakelockReader mKernelWakelockReader = new KernelWakelockReader();
private final KernelWakelockStats mTmpWakelockStats = new KernelWakelockStats();
- private final KernelCpuSpeedReader[] mKernelCpuSpeedReaders;
private IWifiManager mWifiManager = null;
private TelephonyManager mTelephony = null;
private final StatFs mStatFsData = new StatFs(Environment.getDataDirectory().getAbsolutePath());
@@ -115,6 +119,15 @@
private final StatFs mStatFsTemp =
new StatFs(Environment.getDownloadCacheDirectory().getAbsolutePath());
+ private KernelUidCpuTimeReader mKernelUidCpuTimeReader = new KernelUidCpuTimeReader();
+ private KernelCpuSpeedReader[] mKernelCpuSpeedReaders;
+ private KernelUidCpuFreqTimeReader mKernelUidCpuFreqTimeReader =
+ new KernelUidCpuFreqTimeReader();
+ private KernelUidCpuActiveTimeReader mKernelUidCpuActiveTimeReader =
+ new KernelUidCpuActiveTimeReader();
+ private KernelUidCpuClusterTimeReader mKernelUidCpuClusterTimeReader =
+ new KernelUidCpuClusterTimeReader();
+
public StatsCompanionService(Context context) {
super();
mContext = context;
@@ -159,6 +172,13 @@
numSpeedSteps);
firstCpuOfCluster += powerProfile.getNumCoresInCpuCluster(i);
}
+ // use default throttling in
+ // frameworks/base/core/java/com/android/internal/os/KernelCpuProcReader
+ mKernelUidCpuFreqTimeReader.setThrottleInterval(0);
+ long[] freqs = mKernelUidCpuFreqTimeReader.readFreqs(powerProfile);
+ mKernelUidCpuFreqTimeReader.setReadBinary(true);
+ mKernelUidCpuClusterTimeReader.setThrottleInterval(0);
+ mKernelUidCpuActiveTimeReader.setThrottleInterval(0);
}
@Override
@@ -676,6 +696,53 @@
}
}
+ private void pullKernelUidCpuTime(int tagId, List<StatsLogEventWrapper> pulledData) {
+ long elapsedNanos = SystemClock.elapsedRealtimeNanos();
+ mKernelUidCpuTimeReader.readAbsolute((uid, userTimeUs, systemTimeUs) -> {
+ StatsLogEventWrapper e = new StatsLogEventWrapper(elapsedNanos, tagId, 3);
+ e.writeInt(uid);
+ e.writeLong(userTimeUs);
+ e.writeLong(systemTimeUs);
+ pulledData.add(e);
+ });
+ }
+
+ private void pullKernelUidCpuFreqTime(int tagId, List<StatsLogEventWrapper> pulledData) {
+ long elapsedNanos = SystemClock.elapsedRealtimeNanos();
+ mKernelUidCpuFreqTimeReader.readAbsolute((uid, cpuFreqTimeMs) -> {
+ for (int freqIndex = 0; freqIndex < cpuFreqTimeMs.length; ++freqIndex) {
+ StatsLogEventWrapper e = new StatsLogEventWrapper(elapsedNanos, tagId, 3);
+ e.writeInt(uid);
+ e.writeInt(freqIndex);
+ e.writeLong(cpuFreqTimeMs[freqIndex]);
+ pulledData.add(e);
+ }
+ });
+ }
+
+ private void pullKernelUidCpuClusterTime(int tagId, List<StatsLogEventWrapper> pulledData) {
+ long elapsedNanos = SystemClock.elapsedRealtimeNanos();
+ mKernelUidCpuClusterTimeReader.readAbsolute((uid, cpuClusterTimesMs) -> {
+ for (int i = 0; i < cpuClusterTimesMs.length; i++) {
+ StatsLogEventWrapper e = new StatsLogEventWrapper(elapsedNanos, tagId, 3);
+ e.writeInt(uid);
+ e.writeInt(i);
+ e.writeLong(cpuClusterTimesMs[i]);
+ pulledData.add(e);
+ }
+ });
+ }
+
+ private void pullKernelUidCpuActiveTime(int tagId, List<StatsLogEventWrapper> pulledData) {
+ long elapsedNanos = SystemClock.elapsedRealtimeNanos();
+ mKernelUidCpuActiveTimeReader.readAbsolute((uid, cpuActiveTimesMs) -> {
+ StatsLogEventWrapper e = new StatsLogEventWrapper(elapsedNanos, tagId, 2);
+ e.writeInt(uid);
+ e.writeLong((long)cpuActiveTimesMs);
+ pulledData.add(e);
+ });
+ }
+
private void pullWifiActivityEnergyInfo(int tagId, List<StatsLogEventWrapper> pulledData) {
long token = Binder.clearCallingIdentity();
if (mWifiManager == null) {
@@ -828,6 +895,22 @@
pullCpuTimePerFreq(tagId, ret);
break;
}
+ case StatsLog.CPU_TIME_PER_UID: {
+ pullKernelUidCpuTime(tagId, ret);
+ break;
+ }
+ case StatsLog.CPU_TIME_PER_UID_FREQ: {
+ pullKernelUidCpuFreqTime(tagId, ret);
+ break;
+ }
+ case StatsLog.CPU_CLUSTER_TIME: {
+ pullKernelUidCpuClusterTime(tagId, ret);
+ break;
+ }
+ case StatsLog.CPU_ACTIVE_TIME: {
+ pullKernelUidCpuActiveTime(tagId, ret);
+ break;
+ }
case StatsLog.WIFI_ACTIVITY_ENERGY_INFO: {
pullWifiActivityEnergyInfo(tagId, ret);
break;
diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java
index c04522e..2672337 100644
--- a/services/core/java/com/android/server/wm/AppWindowToken.java
+++ b/services/core/java/com/android/server/wm/AppWindowToken.java
@@ -1728,6 +1728,8 @@
frame.set(win.mContainingFrame);
}
surfaceInsets = win.getAttrs().surfaceInsets;
+ // XXX(b/72757033): These are insets relative to the window frame, but we're really
+ // interested in the insets relative to the frame we chose in the if-blocks above.
insets.set(win.mContentInsets);
stableInsets.set(win.mStableInsets);
}
@@ -2120,4 +2122,12 @@
}
return stringName + ((mIsExiting) ? " mIsExiting=" : "");
}
+
+ Rect getLetterboxInsets() {
+ if (mLetterbox != null) {
+ return mLetterbox.getInsets();
+ } else {
+ return new Rect();
+ }
+ }
}
diff --git a/services/core/java/com/android/server/wm/Letterbox.java b/services/core/java/com/android/server/wm/Letterbox.java
index 8fa79ab..0f9735d 100644
--- a/services/core/java/com/android/server/wm/Letterbox.java
+++ b/services/core/java/com/android/server/wm/Letterbox.java
@@ -68,6 +68,17 @@
}
/**
+ * Gets the insets between the outer and inner rects.
+ */
+ public Rect getInsets() {
+ return new Rect(
+ mLeft.getWidth(),
+ mTop.getHeight(),
+ mRight.getWidth(),
+ mBottom.getHeight());
+ }
+
+ /**
* Hides the letterbox.
*
* @param t a transaction in which to hide the letterbox
@@ -141,5 +152,13 @@
mSurface = null;
}
}
+
+ public int getWidth() {
+ return Math.max(0, mLastRight - mLastLeft);
+ }
+
+ public int getHeight() {
+ return Math.max(0, mLastBottom - mLastTop);
+ }
}
}
diff --git a/services/core/java/com/android/server/wm/Session.java b/services/core/java/com/android/server/wm/Session.java
index 94b8518..662d51d 100644
--- a/services/core/java/com/android/server/wm/Session.java
+++ b/services/core/java/com/android/server/wm/Session.java
@@ -193,16 +193,16 @@
int viewVisibility, Rect outContentInsets, Rect outStableInsets,
InputChannel outInputChannel) {
return addToDisplay(window, seq, attrs, viewVisibility, Display.DEFAULT_DISPLAY,
- outContentInsets, outStableInsets, null /* outOutsets */, null /* cutout */,
- outInputChannel);
+ new Rect() /* outFrame */, outContentInsets, outStableInsets, null /* outOutsets */,
+ null /* cutout */, outInputChannel);
}
@Override
public int addToDisplay(IWindow window, int seq, WindowManager.LayoutParams attrs,
- int viewVisibility, int displayId, Rect outContentInsets, Rect outStableInsets,
- Rect outOutsets, DisplayCutout.ParcelableWrapper outDisplayCutout,
- InputChannel outInputChannel) {
- return mService.addWindow(this, window, seq, attrs, viewVisibility, displayId,
+ int viewVisibility, int displayId, Rect outFrame, Rect outContentInsets,
+ Rect outStableInsets, Rect outOutsets,
+ DisplayCutout.ParcelableWrapper outDisplayCutout, InputChannel outInputChannel) {
+ return mService.addWindow(this, window, seq, attrs, viewVisibility, displayId, outFrame,
outContentInsets, outStableInsets, outOutsets, outDisplayCutout, outInputChannel);
}
@@ -217,7 +217,8 @@
public int addToDisplayWithoutInputChannel(IWindow window, int seq, WindowManager.LayoutParams attrs,
int viewVisibility, int displayId, Rect outContentInsets, Rect outStableInsets) {
return mService.addWindow(this, window, seq, attrs, viewVisibility, displayId,
- outContentInsets, outStableInsets, null /* outOutsets */, null /* cutout */, null);
+ new Rect() /* outFrame */, outContentInsets, outStableInsets, null /* outOutsets */,
+ null /* cutout */, null /* outInputChannel */);
}
@Override
diff --git a/services/core/java/com/android/server/wm/TaskSnapshotController.java b/services/core/java/com/android/server/wm/TaskSnapshotController.java
index 3d7b32c..a5a1ca5 100644
--- a/services/core/java/com/android/server/wm/TaskSnapshotController.java
+++ b/services/core/java/com/android/server/wm/TaskSnapshotController.java
@@ -281,17 +281,25 @@
}
private Rect getInsetsFromTaskBounds(WindowState state, Task task) {
- final Rect r = new Rect();
- r.set(state.getContentFrameLw());
- r.intersectUnchecked(state.getStableFrameLw());
+ // XXX(b/72757033): These are insets relative to the window frame, but we're really
+ // interested in the insets relative to the task bounds.
+ Rect insets = minRect(state.mContentInsets, state.mStableInsets);
+ insets = maxRect(insets, state.mAppToken.getLetterboxInsets());
+ return insets;
+ }
- final Rect taskBounds = task.getBounds();
+ private Rect minRect(Rect rect1, Rect rect2) {
+ return new Rect(Math.min(rect1.left, rect2.left),
+ Math.min(rect1.top, rect2.top),
+ Math.min(rect1.right, rect2.right),
+ Math.min(rect1.bottom, rect2.bottom));
+ }
- r.set(Math.max(0, r.left - taskBounds.left),
- Math.max(0, r.top - taskBounds.top),
- Math.max(0, taskBounds.right - r.right),
- Math.max(0, taskBounds.bottom - r.bottom));
- return r;
+ private Rect maxRect(Rect rect1, Rect rect2) {
+ return new Rect(Math.max(rect1.left, rect2.left),
+ Math.max(rect1.top, rect2.top),
+ Math.max(rect1.right, rect2.right),
+ Math.max(rect1.bottom, rect2.bottom));
}
/**
diff --git a/services/core/java/com/android/server/wm/TaskSnapshotSurface.java b/services/core/java/com/android/server/wm/TaskSnapshotSurface.java
index e4db3b0..a9e53a1 100644
--- a/services/core/java/com/android/server/wm/TaskSnapshotSurface.java
+++ b/services/core/java/com/android/server/wm/TaskSnapshotSurface.java
@@ -198,7 +198,7 @@
}
try {
final int res = session.addToDisplay(window, window.mSeq, layoutParams,
- View.GONE, token.getDisplayContent().getDisplayId(), tmpRect, tmpRect,
+ View.GONE, token.getDisplayContent().getDisplayId(), tmpFrame, tmpRect, tmpRect,
tmpRect, tmpCutout, null);
if (res < 0) {
Slog.w(TAG, "Failed to add snapshot starting window res=" + res);
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index bdd64d5..2041c6f 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -1104,7 +1104,7 @@
}
public int addWindow(Session session, IWindow client, int seq,
- LayoutParams attrs, int viewVisibility, int displayId,
+ LayoutParams attrs, int viewVisibility, int displayId, Rect outFrame,
Rect outContentInsets, Rect outStableInsets, Rect outOutsets,
DisplayCutout.ParcelableWrapper outDisplayCutout, InputChannel outInputChannel) {
int[] appOp = new int[1];
@@ -1445,8 +1445,8 @@
} else {
taskBounds = null;
}
- if (mPolicy.getInsetHintLw(win.mAttrs, taskBounds, displayFrames, outContentInsets,
- outStableInsets, outOutsets, outDisplayCutout)) {
+ if (mPolicy.getLayoutHintLw(win.mAttrs, taskBounds, displayFrames, outFrame,
+ outContentInsets, outStableInsets, outOutsets, outDisplayCutout)) {
res |= WindowManagerGlobal.ADD_FLAG_ALWAYS_CONSUME_NAV_BAR;
}
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 6259926..165aaac 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -261,6 +261,8 @@
private boolean mOnlyCore;
private boolean mFirstBoot;
private final boolean mRuntimeRestart;
+ private final long mRuntimeStartElapsedTime;
+ private final long mRuntimeStartUptime;
private static final String START_SENSOR_SERVICE = "StartSensorService";
private static final String START_HIDL_SERVICES = "StartHidlServices";
@@ -292,6 +294,9 @@
mFactoryTestMode = FactoryTest.getMode();
// Remember if it's runtime restart(when sys.boot_completed is already set) or reboot
mRuntimeRestart = "1".equals(SystemProperties.get("sys.boot_completed"));
+
+ mRuntimeStartElapsedTime = SystemClock.elapsedRealtime();
+ mRuntimeStartUptime = SystemClock.uptimeMillis();
}
private void run() {
@@ -402,7 +407,8 @@
// Create the system service manager.
mSystemServiceManager = new SystemServiceManager(mSystemContext);
- mSystemServiceManager.setRuntimeRestarted(mRuntimeRestart);
+ mSystemServiceManager.setStartInfo(mRuntimeRestart,
+ mRuntimeStartElapsedTime, mRuntimeStartUptime);
LocalServices.addService(SystemServiceManager.class, mSystemServiceManager);
// Prepare the thread pool for init tasks that can be parallelized
SystemServerInitThreadPool.get();
diff --git a/services/tests/servicestests/src/com/android/server/am/ActivityStackTests.java b/services/tests/servicestests/src/com/android/server/am/ActivityStackTests.java
index 32a29a2..d60623d 100644
--- a/services/tests/servicestests/src/com/android/server/am/ActivityStackTests.java
+++ b/services/tests/servicestests/src/com/android/server/am/ActivityStackTests.java
@@ -486,4 +486,45 @@
verify(lifecycleManager, times(1)).scheduleTransaction(eq(app.thread),
eq(r.appToken), any(DestroyActivityItem.class));
}
+
+ @Test
+ public void testFinishDisabledPackageActivities() throws Exception {
+ final ActivityRecord firstActivity = new ActivityBuilder(mService).setTask(mTask).build();
+ final ActivityRecord secondActivity = new ActivityBuilder(mService).setTask(mTask).build();
+
+ // Making the second activity a task overlay without an app means it will be removed from
+ // the task's activities as well once first activity is removed.
+ secondActivity.mTaskOverlay = true;
+ secondActivity.app = null;
+
+ assertEquals(mTask.mActivities.size(), 2);
+
+ mStack.finishDisabledPackageActivitiesLocked(firstActivity.packageName, null,
+ true /* doit */, true /* evenPersistent */, UserHandle.USER_ALL);
+
+ assertTrue(mTask.mActivities.isEmpty());
+ assertTrue(mStack.getAllTasks().isEmpty());
+ }
+
+ @Test
+ public void testHandleAppDied() throws Exception {
+ final ActivityRecord firstActivity = new ActivityBuilder(mService).setTask(mTask).build();
+ final ActivityRecord secondActivity = new ActivityBuilder(mService).setTask(mTask).build();
+
+ // Making the first activity a task overlay means it will be removed from the task's
+ // activities as well once second activity is removed as handleAppDied processes the
+ // activity list in reverse.
+ firstActivity.mTaskOverlay = true;
+ firstActivity.app = null;
+
+ // second activity will be immediately removed as it has no state.
+ secondActivity.haveState = false;
+
+ assertEquals(mTask.mActivities.size(), 2);
+
+ mStack.handleAppDiedLocked(secondActivity.app);
+
+ assertTrue(mTask.mActivities.isEmpty());
+ assertTrue(mStack.getAllTasks().isEmpty());
+ }
}
diff --git a/services/tests/servicestests/src/com/android/server/am/ActivityStarterTests.java b/services/tests/servicestests/src/com/android/server/am/ActivityStarterTests.java
index b58c700..fdabfb4 100644
--- a/services/tests/servicestests/src/com/android/server/am/ActivityStarterTests.java
+++ b/services/tests/servicestests/src/com/android/server/am/ActivityStarterTests.java
@@ -197,11 +197,6 @@
final ActivityInfo aInfo = containsConditions(preconditions, PRECONDITION_NO_ACTIVITY_INFO)
? null : new ActivityInfo();
- if (aInfo != null) {
- aInfo.applicationInfo = new ApplicationInfo();
- aInfo.applicationInfo.packageName = ActivityBuilder.DEFAULT_PACKAGE;
- }
-
IVoiceInteractionSession voiceSession =
containsConditions(preconditions, PRECONDITION_SOURCE_VOICE_SESSION)
? mock(IVoiceInteractionSession.class) : null;
@@ -210,6 +205,11 @@
final ActivityBuilder builder = new ActivityBuilder(service).setTask(
new TaskBuilder(service.mStackSupervisor).setVoiceSession(voiceSession).build());
+ if (aInfo != null) {
+ aInfo.applicationInfo = new ApplicationInfo();
+ aInfo.applicationInfo.packageName = builder.getDefaultComponentPackageName();
+ }
+
// Offset uid by one from {@link ActivityInfo} to simulate different uids.
if (containsConditions(preconditions, PRECONDITION_DIFFERENT_UID)) {
builder.setUid(aInfo.applicationInfo.uid + 1);
diff --git a/services/tests/servicestests/src/com/android/server/am/ActivityTestsBase.java b/services/tests/servicestests/src/com/android/server/am/ActivityTestsBase.java
index ff7b1d0..1195188 100644
--- a/services/tests/servicestests/src/com/android/server/am/ActivityTestsBase.java
+++ b/services/tests/servicestests/src/com/android/server/am/ActivityTestsBase.java
@@ -67,6 +67,12 @@
private final Context mContext = InstrumentationRegistry.getContext();
private HandlerThread mHandlerThread;
+ // Default package name
+ static final String DEFAULT_COMPONENT_PACKAGE_NAME = "com.foo";
+
+ // Default base activity name
+ private static final String DEFAULT_COMPONENT_CLASS_NAME = ".BarActivity";
+
@Before
public void setUp() throws Exception {
if (!sOneTimeSetupDone) {
@@ -106,11 +112,7 @@
// An id appended to the end of the component name to make it unique
private static int sCurrentActivityId = 0;
- // Default package name
- static final String DEFAULT_PACKAGE = "com.foo";
- // Default base activity name
- private static final String DEFAULT_BASE_ACTIVITY_NAME = ".BarActivity";
private final ActivityManagerService mService;
@@ -149,11 +151,15 @@
return this;
}
+ String getDefaultComponentPackageName() {
+ return DEFAULT_COMPONENT_PACKAGE_NAME;
+ }
+
ActivityRecord build() {
if (mComponent == null) {
final int id = sCurrentActivityId++;
- mComponent = ComponentName.createRelative(DEFAULT_PACKAGE,
- DEFAULT_BASE_ACTIVITY_NAME + id);
+ mComponent = ComponentName.createRelative(DEFAULT_COMPONENT_PACKAGE_NAME,
+ DEFAULT_COMPONENT_CLASS_NAME + id);
}
if (mCreateTask) {
@@ -191,6 +197,9 @@
* Builder for creating new tasks.
*/
protected static class TaskBuilder {
+ // Default package name
+ static final String DEFAULT_PACKAGE = "com.bar";
+
private final ActivityStackSupervisor mSupervisor;
private ComponentName mComponent;
@@ -252,6 +261,11 @@
aInfo.applicationInfo.packageName = mPackage;
Intent intent = new Intent();
+ if (mComponent == null) {
+ mComponent = ComponentName.createRelative(DEFAULT_COMPONENT_PACKAGE_NAME,
+ DEFAULT_COMPONENT_CLASS_NAME);
+ }
+
intent.setComponent(mComponent);
intent.setFlags(mFlags);
@@ -312,6 +326,8 @@
doNothing().when(supervisor).ensureActivitiesVisibleLocked(any(), anyInt(), anyBoolean());
// Do not schedule idle timeouts
doNothing().when(supervisor).scheduleIdleTimeoutLocked(any());
+ // unit test version does not handle launch wake lock
+ doNothing().when(supervisor).acquireLaunchWakelock();
supervisor.initialize();
diff --git a/services/tests/servicestests/src/com/android/server/policy/PhoneWindowManagerLayoutTest.java b/services/tests/servicestests/src/com/android/server/policy/PhoneWindowManagerLayoutTest.java
index c6800be..b6be3a4 100644
--- a/services/tests/servicestests/src/com/android/server/policy/PhoneWindowManagerLayoutTest.java
+++ b/services/tests/servicestests/src/com/android/server/policy/PhoneWindowManagerLayoutTest.java
@@ -31,6 +31,7 @@
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION;
import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
@@ -278,22 +279,70 @@
}
@Test
- public void insetHint_screenDecorWindow() {
+ public void layoutHint_screenDecorWindow() {
addDisplayCutout();
mAppWindow.attrs.privateFlags |= PRIVATE_FLAG_IS_SCREEN_DECOR;
mPolicy.beginLayoutLw(mFrames, 0 /* UI mode */);
+ final Rect frame = new Rect();
final Rect content = new Rect();
final Rect stable = new Rect();
final Rect outsets = new Rect();
final DisplayCutout.ParcelableWrapper cutout = new DisplayCutout.ParcelableWrapper();
- mPolicy.getInsetHintLw(mAppWindow.attrs, null /* taskBounds */, mFrames, content,
+ mPolicy.getLayoutHintLw(mAppWindow.attrs, null /* taskBounds */, mFrames, frame, content,
stable, outsets, cutout);
+ assertThat(frame, equalTo(mFrames.mUnrestricted));
assertThat(content, equalTo(new Rect()));
assertThat(stable, equalTo(new Rect()));
assertThat(outsets, equalTo(new Rect()));
assertThat(cutout.get(), equalTo(DisplayCutout.NO_CUTOUT));
}
+
+ @Test
+ public void layoutHint_appWindow() {
+ // Initialize DisplayFrames
+ mPolicy.beginLayoutLw(mFrames, 0 /* UI mode */);
+
+ final Rect outFrame = new Rect();
+ final Rect outContentInsets = new Rect();
+ final Rect outStableInsets = new Rect();
+ final Rect outOutsets = new Rect();
+ final DisplayCutout.ParcelableWrapper outDisplayCutout =
+ new DisplayCutout.ParcelableWrapper();
+
+ mPolicy.getLayoutHintLw(mAppWindow.attrs, null, mFrames, outFrame, outContentInsets,
+ outStableInsets, outOutsets, outDisplayCutout);
+
+ assertThat(outFrame, is(mFrames.mUnrestricted));
+ assertThat(outContentInsets, is(new Rect(0, STATUS_BAR_HEIGHT, 0, NAV_BAR_HEIGHT)));
+ assertThat(outStableInsets, is(new Rect(0, STATUS_BAR_HEIGHT, 0, NAV_BAR_HEIGHT)));
+ assertThat(outOutsets, is(new Rect()));
+ assertThat(outDisplayCutout, is(new DisplayCutout.ParcelableWrapper()));
+ }
+
+ @Test
+ public void layoutHint_appWindowInTask() {
+ // Initialize DisplayFrames
+ mPolicy.beginLayoutLw(mFrames, 0 /* UI mode */);
+
+ final Rect taskBounds = new Rect(100, 100, 200, 200);
+
+ final Rect outFrame = new Rect();
+ final Rect outContentInsets = new Rect();
+ final Rect outStableInsets = new Rect();
+ final Rect outOutsets = new Rect();
+ final DisplayCutout.ParcelableWrapper outDisplayCutout =
+ new DisplayCutout.ParcelableWrapper();
+
+ mPolicy.getLayoutHintLw(mAppWindow.attrs, taskBounds, mFrames, outFrame, outContentInsets,
+ outStableInsets, outOutsets, outDisplayCutout);
+
+ assertThat(outFrame, is(taskBounds));
+ assertThat(outContentInsets, is(new Rect()));
+ assertThat(outStableInsets, is(new Rect()));
+ assertThat(outOutsets, is(new Rect()));
+ assertThat(outDisplayCutout, is(new DisplayCutout.ParcelableWrapper()));
+ }
}
\ No newline at end of file