summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Android.bp1
-rw-r--r--apct-tests/perftests/core/src/android/app/PendingIntentPerfTest.java134
-rw-r--r--apct-tests/perftests/utils/src/android/perftests/utils/StubActivity.java10
-rw-r--r--api/current.txt2
-rw-r--r--cmds/incidentd/src/IncidentService.cpp15
-rw-r--r--cmds/statsd/Android.mk1
-rw-r--r--cmds/statsd/src/anomaly/AnomalyTracker.cpp49
-rw-r--r--cmds/statsd/src/anomaly/AnomalyTracker.h22
-rw-r--r--cmds/statsd/src/anomaly/DurationAnomalyTracker.cpp11
-rw-r--r--cmds/statsd/src/anomaly/DurationAnomalyTracker.h3
-rw-r--r--cmds/statsd/src/statsd_config.proto6
-rw-r--r--cmds/statsd/src/subscriber/IncidentdReporter.cpp78
-rw-r--r--cmds/statsd/src/subscriber/IncidentdReporter.h (renamed from core/java/com/android/internal/car/ICarServiceHelper.aidl)22
-rw-r--r--config/hiddenapi-light-greylist.txt31
-rw-r--r--core/java/android/content/pm/ApplicationInfo.java2
-rw-r--r--core/java/android/database/sqlite/SQLiteDatabase.java1
-rw-r--r--core/java/android/net/MacAddress.java29
-rw-r--r--core/java/android/provider/Settings.java10
-rw-r--r--core/java/com/android/internal/app/PlatLogoActivity.java307
-rw-r--r--core/java/com/android/internal/os/BatteryStatsImpl.java41
-rw-r--r--core/java/com/android/server/BootReceiver.java2
-rw-r--r--core/jni/android_util_Binder.cpp2
-rw-r--r--core/res/res/drawable-nodpi/platlogo.xml52
-rw-r--r--core/res/res/drawable-nodpi/platlogo_m.xml19
-rw-r--r--core/res/res/drawable-nodpi/stat_sys_adb.xml39
-rw-r--r--core/tests/coretests/src/android/provider/SettingsBackupTest.java1
-rw-r--r--data/etc/privapp-permissions-platform.xml1
-rw-r--r--graphics/java/android/graphics/drawable/Drawable.java2
-rw-r--r--media/java/android/media/VolumePolicy.java2
-rw-r--r--[-rwxr-xr-x]packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothAdapter.java9
-rw-r--r--packages/SettingsLib/src/com/android/settingslib/wifi/AccessPointPreference.java17
-rw-r--r--packages/SystemUI/res/layout/recents_onboarding.xml (renamed from packages/SystemUI/res/layout/recents_swipe_up_onboarding.xml)1
-rw-r--r--packages/SystemUI/res/values/ids.xml1
-rw-r--r--packages/SystemUI/res/values/strings.xml2
-rw-r--r--packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl5
-rw-r--r--packages/SystemUI/src/com/android/systemui/OverviewProxyService.java9
-rw-r--r--packages/SystemUI/src/com/android/systemui/Prefs.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/NightDisplayTile.java37
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/RecentsOnboarding.java (renamed from packages/SystemUI/src/com/android/systemui/recents/SwipeUpOnboarding.java)39
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java21
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java79
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java7
-rw-r--r--packages/SystemUI/src/com/android/systemui/volume/VolumeDialogComponent.java7
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java11
-rw-r--r--proto/Android.bp2
-rw-r--r--services/core/java/com/android/server/TelephonyRegistry.java55
-rw-r--r--services/core/java/com/android/server/am/GlobalSettingsToPropertiesMapper.java1
-rw-r--r--services/core/java/com/android/server/am/UserController.java2
-rw-r--r--services/core/java/com/android/server/car/CarServiceHelperService.java91
-rw-r--r--services/core/java/com/android/server/locksettings/recoverablekeystore/RecoverableKeyStoreManager.java23
-rw-r--r--services/core/java/com/android/server/net/watchlist/WatchlistLoggingHandler.java13
-rw-r--r--services/core/java/com/android/server/stats/StatsCompanionService.java4
-rw-r--r--services/java/com/android/server/SystemServer.java5
-rw-r--r--services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/RecoverableKeyStoreManagerTest.java45
-rw-r--r--telephony/java/android/telephony/LocationAccessPolicy.java160
-rw-r--r--telephony/java/android/telephony/SubscriptionManager.java6
-rw-r--r--test-base/Android.bp6
-rw-r--r--test-mock/Android.bp4
-rw-r--r--test-runner/Android.bp4
-rw-r--r--tests/net/java/android/net/MacAddressTest.java11
-rw-r--r--tools/sdkparcelables/src/com/android/sdkparcelables/AncestorCollector.kt18
-rw-r--r--tools/sdkparcelables/src/com/android/sdkparcelables/Main.kt18
-rw-r--r--tools/sdkparcelables/src/com/android/sdkparcelables/ParcelableDetector.kt16
-rw-r--r--tools/sdkparcelables/tests/com/android/sdkparcelables/ParcelableDetectorTest.kt16
64 files changed, 897 insertions, 747 deletions
diff --git a/Android.bp b/Android.bp
index d5e04f9f4e2d..3d56254417e1 100644
--- a/Android.bp
+++ b/Android.bp
@@ -373,7 +373,6 @@ java_library {
"core/java/com/android/internal/appwidget/IAppWidgetHost.aidl",
"core/java/com/android/internal/backup/IBackupTransport.aidl",
"core/java/com/android/internal/backup/IObbBackupService.aidl",
- "core/java/com/android/internal/car/ICarServiceHelper.aidl",
"core/java/com/android/internal/inputmethod/IInputContentUriToken.aidl",
"core/java/com/android/internal/net/INetworkWatchlistManager.aidl",
"core/java/com/android/internal/policy/IKeyguardDrawnCallback.aidl",
diff --git a/apct-tests/perftests/core/src/android/app/PendingIntentPerfTest.java b/apct-tests/perftests/core/src/android/app/PendingIntentPerfTest.java
new file mode 100644
index 000000000000..f8fd51d7b0b6
--- /dev/null
+++ b/apct-tests/perftests/core/src/android/app/PendingIntentPerfTest.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package android.app;
+
+import android.content.Context;
+import android.content.Intent;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
+import android.perftests.utils.StubActivity;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.filters.LargeTest;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+// Due to b/71353150, you might get "java.lang.AssertionError: Binder ProxyMap has too many
+// entries", but it's flaky. Adding "Runtime.getRuntime().gc()" between each iteration solves
+// the problem, but it doesn't seem like it's currently needed.
+
+@RunWith(AndroidJUnit4.class)
+@LargeTest
+public class PendingIntentPerfTest {
+
+ private Context mContext;
+
+ @Rule
+ public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+
+ private Intent mIntent;
+
+ @Before
+ public void setUp() {
+ mContext = InstrumentationRegistry.getTargetContext();
+ mIntent = StubActivity.createLaunchIntent(mContext);
+ }
+
+ /**
+ * Benchmark time to create a PendingIntent.
+ */
+ @Test
+ public void create() {
+ final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ while (state.keepRunning()) {
+ state.pauseTiming();
+ state.resumeTiming();
+
+ final PendingIntent pendingIntent = PendingIntent.getActivity(mContext, 0, mIntent,
+ 0);
+
+ state.pauseTiming();
+ pendingIntent.cancel();
+ state.resumeTiming();
+ }
+ }
+
+ /**
+ * Benchmark time to create a PendingIntent with FLAG_CANCEL_CURRENT, already having an active
+ * PendingIntent.
+ */
+ @Test
+ public void createWithCancelFlag() {
+ final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ while (state.keepRunning()) {
+ state.pauseTiming();
+ final PendingIntent previousPendingIntent = PendingIntent.getActivity(mContext, 0,
+ mIntent, 0);
+ state.resumeTiming();
+
+ final PendingIntent pendingIntent = PendingIntent.getActivity(mContext, 0, mIntent,
+ PendingIntent.FLAG_CANCEL_CURRENT);
+
+ state.pauseTiming();
+ pendingIntent.cancel();
+ state.resumeTiming();
+ }
+ }
+
+ /**
+ * Benchmark time to create a PendingIntent with FLAG_UPDATE_CURRENT, already having an active
+ * PendingIntent.
+ */
+ @Test
+ public void createWithUpdateFlag() {
+ final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ while (state.keepRunning()) {
+ state.pauseTiming();
+ final PendingIntent previousPendingIntent = PendingIntent.getActivity(mContext, 0,
+ mIntent, 0);
+ state.resumeTiming();
+
+ final PendingIntent pendingIntent = PendingIntent.getActivity(mContext, 0, mIntent,
+ PendingIntent.FLAG_UPDATE_CURRENT);
+
+ state.pauseTiming();
+ previousPendingIntent.cancel();
+ pendingIntent.cancel();
+ state.resumeTiming();
+ }
+ }
+
+ /**
+ * Benchmark time to cancel a PendingIntent.
+ */
+ @Test
+ public void cancel() {
+ final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ while (state.keepRunning()) {
+ state.pauseTiming();
+ final PendingIntent pendingIntent = PendingIntent.getActivity(mContext, 0,
+ mIntent, 0);
+ state.resumeTiming();
+
+ pendingIntent.cancel();
+ }
+ }
+}
+
diff --git a/apct-tests/perftests/utils/src/android/perftests/utils/StubActivity.java b/apct-tests/perftests/utils/src/android/perftests/utils/StubActivity.java
index 6012f4b12b3d..8f03f7eea584 100644
--- a/apct-tests/perftests/utils/src/android/perftests/utils/StubActivity.java
+++ b/apct-tests/perftests/utils/src/android/perftests/utils/StubActivity.java
@@ -17,6 +17,14 @@
package android.perftests.utils;
import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
public class StubActivity extends Activity {
-} \ No newline at end of file
+ public static Intent createLaunchIntent(Context context) {
+ final Intent intent = new Intent();
+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ intent.setClass(context, StubActivity.class);
+ return intent;
+ }
+}
diff --git a/api/current.txt b/api/current.txt
index 9669cfd0a38c..c03798f08fc9 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -14603,7 +14603,7 @@ package android.graphics.drawable {
method public final android.graphics.Rect copyBounds();
method public static android.graphics.drawable.Drawable createFromPath(java.lang.String);
method public static android.graphics.drawable.Drawable createFromResourceStream(android.content.res.Resources, android.util.TypedValue, java.io.InputStream, java.lang.String);
- method public static android.graphics.drawable.Drawable createFromResourceStream(android.content.res.Resources, android.util.TypedValue, java.io.InputStream, java.lang.String, android.graphics.BitmapFactory.Options);
+ method public static deprecated android.graphics.drawable.Drawable createFromResourceStream(android.content.res.Resources, android.util.TypedValue, java.io.InputStream, java.lang.String, android.graphics.BitmapFactory.Options);
method public static android.graphics.drawable.Drawable createFromStream(java.io.InputStream, java.lang.String);
method public static android.graphics.drawable.Drawable createFromXml(android.content.res.Resources, org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
method public static android.graphics.drawable.Drawable createFromXml(android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.content.res.Resources.Theme) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
diff --git a/cmds/incidentd/src/IncidentService.cpp b/cmds/incidentd/src/IncidentService.cpp
index 1d5ab59f9ba8..654036ec6ab7 100644
--- a/cmds/incidentd/src/IncidentService.cpp
+++ b/cmds/incidentd/src/IncidentService.cpp
@@ -46,6 +46,7 @@ static Status
checkIncidentPermissions(const IncidentReportArgs& args)
{
uid_t callingUid = IPCThreadState::self()->getCallingUid();
+ pid_t callingPid = IPCThreadState::self()->getCallingPid();
if (callingUid == AID_ROOT || callingUid == AID_SHELL) {
// root doesn't have permission.DUMP if don't do this!
return Status::ok();
@@ -54,13 +55,13 @@ checkIncidentPermissions(const IncidentReportArgs& args)
// checking calling permission.
if (!checkCallingPermission(DUMP_PERMISSION)) {
ALOGW("Calling pid %d and uid %d does not have permission: android.permission.DUMP",
- IPCThreadState::self()->getCallingPid(), callingUid);
+ callingPid, callingUid);
return Status::fromExceptionCode(Status::EX_SECURITY,
"Calling process does not have permission: android.permission.DUMP");
}
if (!checkCallingPermission(USAGE_STATS_PERMISSION)) {
ALOGW("Calling pid %d and uid %d does not have permission: android.permission.USAGE_STATS",
- IPCThreadState::self()->getCallingPid(), callingUid);
+ callingPid, callingUid);
return Status::fromExceptionCode(Status::EX_SECURITY,
"Calling process does not have permission: android.permission.USAGE_STATS");
}
@@ -68,13 +69,17 @@ checkIncidentPermissions(const IncidentReportArgs& args)
// checking calling request uid permission.
switch (args.dest()) {
case DEST_LOCAL:
- if (callingUid != AID_SHELL || callingUid != AID_ROOT) {
+ if (callingUid != AID_SHELL && callingUid != AID_ROOT) {
+ ALOGW("Calling pid %d and uid %d does not have permission to get local data.",
+ callingPid, callingUid);
return Status::fromExceptionCode(Status::EX_SECURITY,
"Calling process does not have permission to get local data.");
}
case DEST_EXPLICIT:
- if (callingUid != AID_SHELL || callingUid != AID_ROOT ||
- callingUid != AID_STATSD || callingUid != AID_SYSTEM) {
+ if (callingUid != AID_SHELL && callingUid != AID_ROOT &&
+ callingUid != AID_STATSD && callingUid != AID_SYSTEM) {
+ ALOGW("Calling pid %d and uid %d does not have permission to get explicit data.",
+ callingPid, callingUid);
return Status::fromExceptionCode(Status::EX_SECURITY,
"Calling process does not have permission to get explicit data.");
}
diff --git a/cmds/statsd/Android.mk b/cmds/statsd/Android.mk
index b0019ac90708..b46c5c1b6372 100644
--- a/cmds/statsd/Android.mk
+++ b/cmds/statsd/Android.mk
@@ -65,6 +65,7 @@ statsd_common_src := \
src/storage/StorageManager.cpp \
src/StatsLogProcessor.cpp \
src/StatsService.cpp \
+ src/subscriber/IncidentdReporter.cpp \
src/subscriber/SubscriberReporter.cpp \
src/HashableDimensionKey.cpp \
src/guardrail/MemoryLeakTrackUtil.cpp \
diff --git a/cmds/statsd/src/anomaly/AnomalyTracker.cpp b/cmds/statsd/src/anomaly/AnomalyTracker.cpp
index 79b7d9c49f86..7c5e45e100a5 100644
--- a/cmds/statsd/src/anomaly/AnomalyTracker.cpp
+++ b/cmds/statsd/src/anomaly/AnomalyTracker.cpp
@@ -19,13 +19,11 @@
#include "AnomalyTracker.h"
#include "external/Perfetto.h"
-#include "guardrail/StatsdStats.h"
#include "frameworks/base/libs/incident/proto/android/os/header.pb.h"
+#include "guardrail/StatsdStats.h"
+#include "subscriber/IncidentdReporter.h"
#include "subscriber/SubscriberReporter.h"
-#include <android/os/IIncidentManager.h>
-#include <android/os/IncidentReportArgs.h>
-#include <binder/IServiceManager.h>
#include <statslog.h>
#include <time.h>
@@ -38,15 +36,14 @@ AnomalyTracker::AnomalyTracker(const Alert& alert, const ConfigKey& configKey)
: mAlert(alert), mConfigKey(configKey), mNumOfPastBuckets(mAlert.num_buckets() - 1) {
VLOG("AnomalyTracker() called");
if (mAlert.num_buckets() <= 0) {
- ALOGE("Cannot create AnomalyTracker with %lld buckets",
- (long long)mAlert.num_buckets());
+ ALOGE("Cannot create AnomalyTracker with %lld buckets", (long long)mAlert.num_buckets());
return;
}
if (!mAlert.has_trigger_if_sum_gt()) {
ALOGE("Cannot create AnomalyTracker without threshold");
return;
}
- resetStorage(); // initialization
+ resetStorage(); // initialization
}
AnomalyTracker::~AnomalyTracker() {
@@ -169,8 +166,8 @@ bool AnomalyTracker::detectAnomaly(const int64_t& currentBucketNum, const Metric
// TODO: This creates a needless 0 entry in mSumOverPastBuckets. Fix this.
addPastBucket(key, 0, currentBucketNum - 1);
}
- return mAlert.has_trigger_if_sum_gt()
- && getSumOverPastBuckets(key) + currentBucketValue > mAlert.trigger_if_sum_gt();
+ return mAlert.has_trigger_if_sum_gt() &&
+ getSumOverPastBuckets(key) + currentBucketValue > mAlert.trigger_if_sum_gt();
}
void AnomalyTracker::declareAnomaly(const uint64_t& timestampNs, const MetricDimensionKey& key) {
@@ -186,7 +183,7 @@ void AnomalyTracker::declareAnomaly(const uint64_t& timestampNs, const MetricDim
if (!mSubscriptions.empty()) {
if (mAlert.has_id()) {
- ALOGI("An anomaly (%llu) has occurred! Informing subscribers.",mAlert.id());
+ ALOGI("An anomaly (%llu) has occurred! Informing subscribers.", mAlert.id());
informSubscribers(key);
} else {
ALOGI("An anomaly (with no id) has occurred! Not informing any subscribers.");
@@ -231,44 +228,26 @@ void AnomalyTracker::informSubscribers(const MetricDimensionKey& key) {
return;
}
- std::set<int> incidentdSections;
-
for (const Subscription& subscription : mSubscriptions) {
switch (subscription.subscriber_information_case()) {
case Subscription::SubscriberInformationCase::kIncidentdDetails:
- for (int i = 0; i < subscription.incidentd_details().section_size(); i++) {
- incidentdSections.insert(subscription.incidentd_details().section(i));
+ if (!GenerateIncidentReport(subscription.incidentd_details(), mAlert, mConfigKey)) {
+ ALOGW("Failed to generate incident report.");
}
break;
case Subscription::SubscriberInformationCase::kPerfettoDetails:
- CollectPerfettoTraceAndUploadToDropbox(subscription.perfetto_details());
+ if (!CollectPerfettoTraceAndUploadToDropbox(subscription.perfetto_details())) {
+ ALOGW("Failed to generate prefetto traces.");
+ }
break;
case Subscription::SubscriberInformationCase::kBroadcastSubscriberDetails:
- SubscriberReporter::getInstance()
- .alertBroadcastSubscriber(mConfigKey, subscription, key);
+ SubscriberReporter::getInstance().alertBroadcastSubscriber(mConfigKey, subscription,
+ key);
break;
default:
break;
}
}
- if (!incidentdSections.empty()) {
- sp<IIncidentManager> service = interface_cast<IIncidentManager>(
- defaultServiceManager()->getService(android::String16("incident")));
- if (service != NULL) {
- IncidentReportArgs incidentReport;
- for (const auto section : incidentdSections) {
- incidentReport.addSection(section);
- }
- android::os::IncidentHeaderProto header;
- header.set_alert_id(mAlert.id());
- header.mutable_config_key()->set_uid(mConfigKey.GetUid());
- header.mutable_config_key()->set_id(mConfigKey.GetId());
- incidentReport.addHeader(header);
- service->reportIncident(incidentReport);
- } else {
- ALOGW("Couldn't get the incident service.");
- }
- }
}
} // namespace statsd
diff --git a/cmds/statsd/src/anomaly/AnomalyTracker.h b/cmds/statsd/src/anomaly/AnomalyTracker.h
index f01a97f86cf6..3be959d14109 100644
--- a/cmds/statsd/src/anomaly/AnomalyTracker.h
+++ b/cmds/statsd/src/anomaly/AnomalyTracker.h
@@ -16,22 +16,24 @@
#pragma once
+#include <memory> // unique_ptr
+
+#include <stdlib.h>
+
#include <gtest/gtest_prod.h>
+#include <utils/RefBase.h>
+
#include "AnomalyMonitor.h"
#include "config/ConfigKey.h"
#include "frameworks/base/cmds/statsd/src/statsd_config.pb.h" // Alert
#include "stats_util.h" // HashableDimensionKey and DimToValMap
-#include <memory> // unique_ptr
-#include <stdlib.h>
-#include <utils/RefBase.h>
-
namespace android {
namespace os {
namespace statsd {
-using std::unordered_map;
using std::shared_ptr;
+using std::unordered_map;
// Does NOT allow negative values.
class AnomalyTracker : public virtual RefBase {
@@ -60,12 +62,11 @@ public:
// Detects the alert and informs the incidentd when applicable.
void detectAndDeclareAnomaly(const uint64_t& timestampNs, const int64_t& currBucketNum,
- const MetricDimensionKey& key,
- const int64_t& currentBucketValue);
+ const MetricDimensionKey& key, const int64_t& currentBucketValue);
// Init the AnomalyMonitor which is shared across anomaly trackers.
virtual void setAnomalyMonitor(const sp<AnomalyMonitor>& anomalyMonitor) {
- return; // Base AnomalyTracker class has no need for the AnomalyMonitor.
+ return; // Base AnomalyTracker class has no need for the AnomalyMonitor.
}
// Helper function to return the sum value of past buckets at given dimension.
@@ -92,9 +93,10 @@ public:
// Declares an anomaly for each alarm in firedAlarms that belongs to this AnomalyTracker,
// and removes it from firedAlarms. Does NOT remove the alarm from the AnomalyMonitor.
- virtual void informAlarmsFired(const uint64_t& timestampNs,
+ virtual void informAlarmsFired(
+ const uint64_t& timestampNs,
unordered_set<sp<const AnomalyAlarm>, SpHash<AnomalyAlarm>>& firedAlarms) {
- return; // The base AnomalyTracker class doesn't have alarms.
+ return; // The base AnomalyTracker class doesn't have alarms.
}
protected:
diff --git a/cmds/statsd/src/anomaly/DurationAnomalyTracker.cpp b/cmds/statsd/src/anomaly/DurationAnomalyTracker.cpp
index bbee9fa5358c..e459f7681f26 100644
--- a/cmds/statsd/src/anomaly/DurationAnomalyTracker.cpp
+++ b/cmds/statsd/src/anomaly/DurationAnomalyTracker.cpp
@@ -52,8 +52,7 @@ void DurationAnomalyTracker::declareAnomalyIfAlarmExpired(const MetricDimensionK
}
void DurationAnomalyTracker::startAlarm(const MetricDimensionKey& dimensionKey,
- const uint64_t& timestampNs) {
-
+ const uint64_t& timestampNs) {
uint32_t timestampSec = static_cast<uint32_t>(timestampNs / NS_PER_SEC);
if (isInRefractoryPeriod(timestampNs, dimensionKey)) {
VLOG("Skipping setting anomaly alarm since it'd fall in the refractory period");
@@ -86,15 +85,15 @@ void DurationAnomalyTracker::stopAllAlarms() {
}
}
-void DurationAnomalyTracker::informAlarmsFired(const uint64_t& timestampNs,
+void DurationAnomalyTracker::informAlarmsFired(
+ const uint64_t& timestampNs,
unordered_set<sp<const AnomalyAlarm>, SpHash<AnomalyAlarm>>& firedAlarms) {
-
if (firedAlarms.empty() || mAlarms.empty()) return;
// Find the intersection of firedAlarms and mAlarms.
// The for loop is inefficient, since it loops over all keys, but that's okay since it is very
// seldomly called. The alternative would be having AnomalyAlarms store information about the
- // DurationAnomalyTracker and key, but that's a lot of data overhead to speed up something that is
- // rarely ever called.
+ // DurationAnomalyTracker and key, but that's a lot of data overhead to speed up something that
+ // is rarely ever called.
unordered_map<MetricDimensionKey, sp<const AnomalyAlarm>> matchedAlarms;
for (const auto& kv : mAlarms) {
if (firedAlarms.count(kv.second) > 0) {
diff --git a/cmds/statsd/src/anomaly/DurationAnomalyTracker.h b/cmds/statsd/src/anomaly/DurationAnomalyTracker.h
index 052fdf576289..ba687dacf519 100644
--- a/cmds/statsd/src/anomaly/DurationAnomalyTracker.h
+++ b/cmds/statsd/src/anomaly/DurationAnomalyTracker.h
@@ -53,7 +53,8 @@ public:
// and removes it from firedAlarms.
// Note that this will generally be called from a different thread from the other functions;
// the caller is responsible for thread safety.
- void informAlarmsFired(const uint64_t& timestampNs,
+ void informAlarmsFired(
+ const uint64_t& timestampNs,
unordered_set<sp<const AnomalyAlarm>, SpHash<AnomalyAlarm>>& firedAlarms) override;
protected:
diff --git a/cmds/statsd/src/statsd_config.proto b/cmds/statsd/src/statsd_config.proto
index 3eaf7a17a3e2..5a326a47eb24 100644
--- a/cmds/statsd/src/statsd_config.proto
+++ b/cmds/statsd/src/statsd_config.proto
@@ -275,6 +275,12 @@ message Alarm {
message IncidentdDetails {
repeated int32 section = 1;
+
+ enum Destination {
+ AUTOMATIC = 0;
+ EXPLICIT = 1;
+ }
+ optional Destination dest = 2;
}
message PerfettoDetails {
diff --git a/cmds/statsd/src/subscriber/IncidentdReporter.cpp b/cmds/statsd/src/subscriber/IncidentdReporter.cpp
new file mode 100644
index 000000000000..d9a8fc894804
--- /dev/null
+++ b/cmds/statsd/src/subscriber/IncidentdReporter.cpp
@@ -0,0 +1,78 @@
+/*
+ * 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 true
+#include "Log.h"
+
+#include "IncidentdReporter.h"
+#include "frameworks/base/libs/incident/proto/android/os/header.pb.h"
+
+#include <android/os/IIncidentManager.h>
+#include <android/os/IncidentReportArgs.h>
+#include <binder/IBinder.h>
+#include <binder/IServiceManager.h>
+
+namespace android {
+namespace os {
+namespace statsd {
+
+bool GenerateIncidentReport(const IncidentdDetails& config, const Alert& alert,
+ const ConfigKey& configKey) {
+ if (config.section_size() == 0) {
+ VLOG("The alert %lld contains zero section in config(%d,%lld)", alert.id(),
+ configKey.GetUid(), (long long) configKey.GetId());
+ return false;
+ }
+
+ IncidentReportArgs incidentReport;
+
+ android::os::IncidentHeaderProto header;
+ header.set_alert_id(alert.id());
+ header.mutable_config_key()->set_uid(configKey.GetUid());
+ header.mutable_config_key()->set_id(configKey.GetId());
+ incidentReport.addHeader(header);
+
+ for (int i = 0; i < config.section_size(); i++) {
+ incidentReport.addSection(config.section(i));
+ }
+
+ uint8_t dest;
+ switch (config.dest()) {
+ case IncidentdDetails_Destination_AUTOMATIC:
+ dest = android::os::DEST_AUTOMATIC;
+ break;
+ case IncidentdDetails_Destination_EXPLICIT:
+ dest = android::os::DEST_EXPLICIT;
+ break;
+ default:
+ dest = android::os::DEST_AUTOMATIC;
+ }
+ incidentReport.setDest(dest);
+
+ sp<IIncidentManager> service = interface_cast<IIncidentManager>(
+ defaultServiceManager()->getService(android::String16("incident")));
+ if (service == nullptr) {
+ ALOGW("Failed to fetch incident service.");
+ return false;
+ }
+ VLOG("Calling incidentd %p", service.get());
+ binder::Status s = service->reportIncident(incidentReport);
+ VLOG("Report incident status: %s", s.toString8().string());
+ return s.isOk();
+}
+
+} // namespace statsd
+} // namespace os
+} // namespace android
diff --git a/core/java/com/android/internal/car/ICarServiceHelper.aidl b/cmds/statsd/src/subscriber/IncidentdReporter.h
index 9ee330be060b..229ed778af3a 100644
--- a/core/java/com/android/internal/car/ICarServiceHelper.aidl
+++ b/cmds/statsd/src/subscriber/IncidentdReporter.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017 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.
@@ -14,11 +14,21 @@
* limitations under the License.
*/
-package com.android.internal.car;
+#pragma once
+
+#include "config/ConfigKey.h"
+#include "frameworks/base/cmds/statsd/src/statsd_config.pb.h" // Alert, IncidentdDetails
+
+namespace android {
+namespace os {
+namespace statsd {
/**
- * Helper API for car service. Only for itneraction between system server and car service.
- * @hide
+ * Calls incidentd to trigger an incident report and put in dropbox for uploading.
*/
-interface ICarServiceHelper {
-}
+bool GenerateIncidentReport(const IncidentdDetails& config, const Alert& alert,
+ const ConfigKey& configKey);
+
+} // namespace statsd
+} // namespace os
+} // namespace android
diff --git a/config/hiddenapi-light-greylist.txt b/config/hiddenapi-light-greylist.txt
index c173c2c515bc..11fd5971b6b3 100644
--- a/config/hiddenapi-light-greylist.txt
+++ b/config/hiddenapi-light-greylist.txt
@@ -65,6 +65,12 @@ Landroid/app/admin/DevicePolicyManager;->packageHasActiveAdmins(Ljava/lang/Strin
Landroid/app/admin/DevicePolicyManager;->packageHasActiveAdmins(Ljava/lang/String;)Z
Landroid/app/admin/DevicePolicyManager;->setActiveAdmin(Landroid/content/ComponentName;ZI)V
Landroid/app/admin/DevicePolicyManager;->setActiveAdmin(Landroid/content/ComponentName;Z)V
+Landroid/app/AlarmManager;->FLAG_ALLOW_WHILE_IDLE_UNRESTRICTED:I
+Landroid/app/AlarmManager;->FLAG_IDLE_UNTIL:I
+Landroid/app/AlarmManager;->FLAG_STANDALONE:I
+Landroid/app/AlarmManager;->FLAG_WAKE_FROM_IDLE:I
+Landroid/app/AlarmManager;->WINDOW_EXACT:J
+Landroid/app/AlarmManager;->WINDOW_HEURISTIC:J
Landroid/app/AlertDialog$Builder;->P:Lcom/android/internal/app/AlertController$AlertParams;
Landroid/app/AlertDialog;->mAlert:Lcom/android/internal/app/AlertController;
Landroid/app/AppGlobals;->getInitialApplication()Landroid/app/Application;
@@ -133,6 +139,7 @@ Landroid/app/StatusBarManager;->expandNotificationsPanel()V
Landroid/app/StatusBarManager;->expandSettingsPanel(Ljava/lang/String;)V
Landroid/app/StatusBarManager;->expandSettingsPanel()V
Landroid/app/TimePickerDialog;->mTimePicker:Landroid/widget/TimePicker;
+Landroid/app/WallpaperColors;->getColorHints()I
Landroid/app/WallpaperManager;->getBitmap()Landroid/graphics/Bitmap;
Landroid/app/WallpaperManager;->getBitmap(Z)Landroid/graphics/Bitmap;
Landroid/app/WallpaperManager;->getIWallpaperManager()Landroid/app/IWallpaperManager;
@@ -413,6 +420,7 @@ Landroid/os/AsyncTask;->mTaskInvoked:Ljava/util/concurrent/atomic/AtomicBoolean;
Landroid/os/AsyncTask;->mWorker:Landroid/os/AsyncTask$WorkerRunnable;
Landroid/os/AsyncTask;->sDefaultExecutor:Ljava/util/concurrent/Executor;
Landroid/os/AsyncTask;->setDefaultExecutor(Ljava/util/concurrent/Executor;)V
+Landroid/os/BatteryStats$HistoryItem;->states2:I
Landroid/os/BatteryStats;->NUM_DATA_CONNECTION_TYPES:I
Landroid/os/BatteryStats$Timer;->getTotalTimeLocked(JI)J
Landroid/os/BatteryStats$Uid;->getFullWifiLockTime(JI)J
@@ -534,13 +542,18 @@ Landroid/os/UpdateEngine;->cancel()V
Landroid/os/UpdateEngine;->resetStatus()V
Landroid/os/UpdateLock;->acquire()V
Landroid/os/UpdateLock;->isHeld()Z
+Landroid/os/UpdateLock;->NOW_IS_CONVENIENT:Ljava/lang/String;
Landroid/os/UpdateLock;->release()V
+Landroid/os/UpdateLock;->UPDATE_LOCK_CHANGED:Ljava/lang/String;
Landroid/os/UserHandle;->ALL:Landroid/os/UserHandle;
+Landroid/os/UserHandle;->getAppIdFromSharedAppGid(I)I
Landroid/os/UserHandle;->getIdentifier()I
Landroid/os/UserHandle;->getUserId(I)I
+Landroid/os/UserHandle;-><init>(I)V
Landroid/os/UserHandle;->isOwner()Z
Landroid/os/UserHandle;->myUserId()I
Landroid/os/UserHandle;->of(I)Landroid/os/UserHandle;
+Landroid/os/UserManager;->getBadgedLabelForUser(Ljava/lang/CharSequence;Landroid/os/UserHandle;)Ljava/lang/CharSequence;
Landroid/os/UserManager;->get(Landroid/content/Context;)Landroid/os/UserManager;
Landroid/os/UserManager;->getMaxSupportedUsers()I
Landroid/os/UserManager;->getProfiles(I)Ljava/util/List;
@@ -987,9 +1000,27 @@ Landroid/widget/VideoView;->mVideoHeight:I
Landroid/widget/VideoView;->mVideoWidth:I
Lcom/android/internal/app/IBatteryStats;->getStatistics()[B
Lcom/android/internal/app/IBatteryStats$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/app/IBatteryStats;
+Lcom/android/internal/os/BatterySipper;->add(Lcom/android/internal/os/BatterySipper;)V
+Lcom/android/internal/os/BatterySipper;->drainType:Lcom/android/internal/os/BatterySipper$DrainType;
+Lcom/android/internal/os/BatterySipper;->getUid()I
+Lcom/android/internal/os/BatterySipper;-><init>(Lcom/android/internal/os/BatterySipper$DrainType;Landroid/os/BatteryStats$Uid;D)V
+Lcom/android/internal/os/BatterySipper;->mPackages:[Ljava/lang/String;
+Lcom/android/internal/os/BatterySipper;->packageWithHighestDrain:Ljava/lang/String;
+Lcom/android/internal/os/BatterySipper;->totalPowerMah:D
+Lcom/android/internal/os/BatterySipper;->uidObj:Landroid/os/BatteryStats$Uid;
+Lcom/android/internal/os/BatteryStatsHelper;->getMaxPower()D
+Lcom/android/internal/os/BatteryStatsHelper;->getStats()Landroid/os/BatteryStats;
+Lcom/android/internal/os/BatteryStatsHelper;->getTotalPower()D
+Lcom/android/internal/os/BatteryStatsHelper;-><init>(Landroid/content/Context;ZZ)V
+Lcom/android/internal/os/BatteryStatsHelper;->load()V
+Lcom/android/internal/os/BatteryStatsHelper;->mBatteryInfo:Lcom/android/internal/app/IBatteryStats;
+Lcom/android/internal/os/BatteryStatsHelper;->mPowerProfile:Lcom/android/internal/os/PowerProfile;
+Lcom/android/internal/os/BatteryStatsHelper;->mUsageList:Ljava/util/List;
+Lcom/android/internal/os/BatteryStatsHelper;->refreshStats(II)V
Lcom/android/internal/os/BatteryStatsImpl;->computeBatteryRealtime(JI)J
Lcom/android/internal/os/BatteryStatsImpl;->computeBatteryUptime(JI)J
Lcom/android/internal/os/BatteryStatsImpl;->CREATOR:Landroid/os/Parcelable$Creator;
+Lcom/android/internal/os/BatteryStatsImpl;->getDischargeAmount(I)I
Lcom/android/internal/os/BatteryStatsImpl;->getGlobalWifiRunningTime(JI)J
Lcom/android/internal/os/BatteryStatsImpl;->getScreenOnTime(JI)J
Lcom/android/internal/os/BatteryStatsImpl;->getUidStats()Landroid/util/SparseArray;
diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java
index db1630b67bd2..1adc9f503f75 100644
--- a/core/java/android/content/pm/ApplicationInfo.java
+++ b/core/java/android/content/pm/ApplicationInfo.java
@@ -1601,7 +1601,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
* @hide
*/
public boolean isAllowedToUseHiddenApi() {
- return isSystemApp();
+ return isSystemApp() || isUpdatedSystemApp();
}
/**
diff --git a/core/java/android/database/sqlite/SQLiteDatabase.java b/core/java/android/database/sqlite/SQLiteDatabase.java
index c1c0812e129e..ae1f57d62228 100644
--- a/core/java/android/database/sqlite/SQLiteDatabase.java
+++ b/core/java/android/database/sqlite/SQLiteDatabase.java
@@ -2006,7 +2006,6 @@ public final class SQLiteDatabase extends SQLiteClosable {
* SQLiteDatabase db = SQLiteDatabase.openDatabase("db_filename", cursorFactory,
* SQLiteDatabase.CREATE_IF_NECESSARY | SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING,
* myDatabaseErrorHandler);
- * db.enableWriteAheadLogging();
* </pre></code>
* </p><p>
* Another way to enable write-ahead logging is to call {@link #enableWriteAheadLogging}
diff --git a/core/java/android/net/MacAddress.java b/core/java/android/net/MacAddress.java
index 287bdc88dd3e..74d64704c8d2 100644
--- a/core/java/android/net/MacAddress.java
+++ b/core/java/android/net/MacAddress.java
@@ -26,6 +26,7 @@ import com.android.internal.util.Preconditions;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
+import java.security.SecureRandom;
import java.util.Arrays;
import java.util.Random;
@@ -329,16 +330,34 @@ public final class MacAddress implements Parcelable {
/**
* Returns a generated MAC address whose 24 least significant bits constituting the
- * NIC part of the address are randomly selected.
+ * NIC part of the address are randomly selected and has Google OUI base.
*
* The locally assigned bit is always set to 1. The multicast bit is always set to 0.
*
- * @return a random locally assigned MacAddress.
+ * @return a random locally assigned, unicast MacAddress with Google OUI.
+ *
+ * @hide
+ */
+ public static @NonNull MacAddress createRandomUnicastAddressWithGoogleBase() {
+ return createRandomUnicastAddress(BASE_GOOGLE_MAC, new SecureRandom());
+ }
+
+ /**
+ * Returns a generated MAC address whose 46 bits, excluding the locally assigned bit and the
+ * unicast bit, are randomly selected.
+ *
+ * The locally assigned bit is always set to 1. The multicast bit is always set to 0.
+ *
+ * @return a random locally assigned, unicast MacAddress.
*
* @hide
*/
public static @NonNull MacAddress createRandomUnicastAddress() {
- return createRandomUnicastAddress(BASE_GOOGLE_MAC, new Random());
+ SecureRandom r = new SecureRandom();
+ long addr = r.nextLong() & VALID_LONG_MASK;
+ addr |= LOCALLY_ASSIGNED_MASK;
+ addr &= ~MULTICAST_MASK;
+ return new MacAddress(addr);
}
/**
@@ -355,8 +374,8 @@ public final class MacAddress implements Parcelable {
*/
public static @NonNull MacAddress createRandomUnicastAddress(MacAddress base, Random r) {
long addr = (base.mAddr & OUI_MASK) | (NIC_MASK & r.nextLong());
- addr = addr | LOCALLY_ASSIGNED_MASK;
- addr = addr & ~MULTICAST_MASK;
+ addr |= LOCALLY_ASSIGNED_MASK;
+ addr &= ~MULTICAST_MASK;
return new MacAddress(addr);
}
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index b6fab1e45500..7fd75c97fa14 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -10315,16 +10315,6 @@ public final class Settings {
public static final String SYS_VDSO = "sys_vdso";
/**
- * Uid CpuPower global setting. This links the uid.cpupower system property.
- * The following values are supported:
- * 0 -> /proc/uid_cpupower/* are disabled
- * 1 -> /proc/uid_cpupower/* are enabled
- * Any other value defaults to enabled.
- * @hide
- */
- public static final String UID_CPUPOWER = "uid_cpupower";
-
- /**
* An integer to reduce the FPS by this factor. Only for experiments. Need to reboot the
* device for this setting to take full effect.
*
diff --git a/core/java/com/android/internal/app/PlatLogoActivity.java b/core/java/com/android/internal/app/PlatLogoActivity.java
index b22ce5e2a6ee..f6a69d9aeb93 100644
--- a/core/java/com/android/internal/app/PlatLogoActivity.java
+++ b/core/java/com/android/internal/app/PlatLogoActivity.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 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.
@@ -16,157 +16,214 @@
package com.android.internal.app;
-import android.animation.Animator;
-import android.animation.ObjectAnimator;
-import android.annotation.Nullable;
+import android.animation.TimeAnimator;
import android.app.Activity;
-import android.content.ActivityNotFoundException;
-import android.content.ContentResolver;
-import android.content.Intent;
-import android.content.res.ColorStateList;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
-import android.graphics.Outline;
import android.graphics.Paint;
import android.graphics.Path;
-import android.graphics.PixelFormat;
-import android.graphics.PorterDuff;
-import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.Drawable;
-import android.graphics.drawable.GradientDrawable;
-import android.graphics.drawable.RippleDrawable;
-import android.graphics.drawable.ShapeDrawable;
-import android.graphics.drawable.shapes.OvalShape;
import android.os.Bundle;
-import android.provider.Settings;
-import android.util.DisplayMetrics;
import android.util.Log;
-import android.util.MathUtils;
-import android.view.Gravity;
-import android.view.KeyEvent;
+import android.view.MotionEvent;
+import android.view.MotionEvent.PointerCoords;
import android.view.View;
-import android.view.ViewGroup;
-import android.view.ViewOutlineProvider;
-import android.view.animation.PathInterpolator;
import android.widget.FrameLayout;
-import android.widget.ImageView;
public class PlatLogoActivity extends Activity {
- public static final boolean FINISH = true;
+ FrameLayout layout;
+ TimeAnimator anim;
+ PBackground bg;
- FrameLayout mLayout;
- int mTapCount;
- int mKeyCount;
- PathInterpolator mInterpolator = new PathInterpolator(0f, 0f, 0.5f, 1f);
+ private class PBackground extends Drawable {
+ private float maxRadius, radius, x, y, dp;
+ private int[] palette;
+ private int darkest;
+ private float offset;
+
+ public PBackground() {
+ randomizePalette();
+ }
+
+ /**
+ * set inner radius of "p" logo
+ */
+ public void setRadius(float r) {
+ this.radius = Math.max(48*dp, r);
+ }
+
+ /**
+ * move the "p"
+ */
+ public void setPosition(float x, float y) {
+ this.x = x;
+ this.y = y;
+ }
+
+ /**
+ * for animating the "p"
+ */
+ public void setOffset(float o) {
+ this.offset = o;
+ }
+
+ /**
+ * rough luminance calculation
+ * https://www.w3.org/TR/AERT/#color-contrast
+ */
+ public float lum(int rgb) {
+ return ((Color.red(rgb) * 299f) + (Color.green(rgb) * 587f) + (Color.blue(rgb) * 114f)) / 1000f;
+ }
+
+ /**
+ * create a random evenly-spaced color palette
+ * guaranteed to contrast!
+ */
+ public void randomizePalette() {
+ final int slots = 2 + (int)(Math.random() * 2);
+ float[] color = new float[] { (float) Math.random() * 360f, 1f, 1f };
+ palette = new int[slots];
+ darkest = 0;
+ for (int i=0; i<slots; i++) {
+ palette[i] = Color.HSVToColor(color);
+ color[0] += 360f/slots;
+ if (lum(palette[i]) < lum(palette[darkest])) darkest = i;
+ }
+
+ final StringBuilder str = new StringBuilder();
+ for (int c : palette) {
+ str.append(String.format("#%08x ", c));
+ }
+ Log.v("PlatLogoActivity", "color palette: " + str);
+ }
+
+ @Override
+ public void draw(Canvas canvas) {
+ if (dp == 0) dp = getResources().getDisplayMetrics().density;
+ final float width = canvas.getWidth();
+ final float height = canvas.getHeight();
+ if (radius == 0) {
+ setPosition(width / 2, height / 2);
+ setRadius(width / 6);
+ }
+ final float inner_w = radius * 0.667f;
+
+ final Paint paint = new Paint();
+ paint.setStrokeCap(Paint.Cap.BUTT);
+ canvas.translate(x, y);
+
+ Path p = new Path();
+ p.moveTo(-radius, height);
+ p.lineTo(-radius, 0);
+ p.arcTo(-radius, -radius, radius, radius, -180, 270, false);
+ p.lineTo(-radius, radius);
+
+ float w = Math.max(canvas.getWidth(), canvas.getHeight()) * 1.414f;
+ paint.setStyle(Paint.Style.FILL);
+
+ int i=0;
+ while (w > radius*2 + inner_w*2) {
+ paint.setColor(0xFF000000 | palette[i % palette.length]);
+ // for a slower but more complete version:
+ // paint.setStrokeWidth(w);
+ // canvas.drawPath(p, paint);
+ canvas.drawOval(-w/2, -w/2, w/2, w/2, paint);
+ w -= inner_w * (1.1f + Math.sin((i/20f + offset) * 3.14159f));
+ i++;
+ }
+
+ // the innermost circle needs to be a constant color to avoid rapid flashing
+ paint.setColor(0xFF000000 | palette[(darkest+1) % palette.length]);
+ canvas.drawOval(-radius, -radius, radius, radius, paint);
+
+ p.reset();
+ p.moveTo(-radius, height);
+ p.lineTo(-radius, 0);
+ p.arcTo(-radius, -radius, radius, radius, -180, 270, false);
+ p.lineTo(-radius + inner_w, radius);
+
+ paint.setStyle(Paint.Style.STROKE);
+ paint.setStrokeWidth(inner_w*2);
+ paint.setColor(palette[darkest]);
+ canvas.drawPath(p, paint);
+ paint.setStrokeWidth(inner_w);
+ paint.setColor(0xFFFFFFFF);
+ canvas.drawPath(p, paint);
+ }
+
+ @Override
+ public void setAlpha(int alpha) {
+
+ }
+
+ @Override
+ public void setColorFilter(ColorFilter colorFilter) {
+
+ }
+
+ @Override
+ public int getOpacity() {
+ return 0;
+ }
+ }
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- mLayout = new FrameLayout(this);
- setContentView(mLayout);
- }
+ layout = new FrameLayout(this);
+ setContentView(layout);
- @Override
- public void onAttachedToWindow() {
- final DisplayMetrics dm = getResources().getDisplayMetrics();
- final float dp = dm.density;
- final int size = (int)
- (Math.min(Math.min(dm.widthPixels, dm.heightPixels), 600*dp) - 100*dp);
-
- final ImageView im = new ImageView(this);
- final int pad = (int)(40*dp);
- im.setPadding(pad, pad, pad, pad);
- im.setTranslationZ(20);
- im.setScaleX(0.5f);
- im.setScaleY(0.5f);
- im.setAlpha(0f);
-
- im.setBackground(new RippleDrawable(
- ColorStateList.valueOf(0xFF776677),
- getDrawable(com.android.internal.R.drawable.platlogo),
- null));
- im.setOutlineProvider(new ViewOutlineProvider() {
- @Override
- public void getOutline(View view, Outline outline) {
- final int w = view.getWidth();
- final int h = view.getHeight();
- outline.setOval((int)(w*.125), (int)(h*.125), (int)(w*.96), (int)(h*.96));
- }
- });
- im.setElevation(12f*dp);
- im.setClickable(true);
- im.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- im.setOnLongClickListener(new View.OnLongClickListener() {
- @Override
- public boolean onLongClick(View v) {
- if (mTapCount < 5) return false;
-
- final ContentResolver cr = getContentResolver();
- if (Settings.System.getLong(cr, Settings.System.EGG_MODE, 0)
- == 0) {
- // For posterity: the moment this user unlocked the easter egg
- try {
- Settings.System.putLong(cr,
- Settings.System.EGG_MODE,
- System.currentTimeMillis());
- } catch (RuntimeException e) {
- Log.e("PlatLogoActivity", "Can't write settings", e);
- }
- }
- im.post(new Runnable() {
- @Override
- public void run() {
- try {
- startActivity(new Intent(Intent.ACTION_MAIN)
- .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
- | Intent.FLAG_ACTIVITY_CLEAR_TASK
- | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS)
- .addCategory("com.android.internal.category.PLATLOGO"));
- } catch (ActivityNotFoundException ex) {
- Log.e("PlatLogoActivity", "No more eggs.");
- }
- if (FINISH) finish();
- }
- });
- return true;
- }
- });
- mTapCount++;
- }
- });
+ bg = new PBackground();
+ layout.setBackground(bg);
+
+ layout.setOnTouchListener(new View.OnTouchListener() {
+ final PointerCoords pc0 = new PointerCoords();
+ final PointerCoords pc1 = new PointerCoords();
- // Enable hardware keyboard input for TV compatibility.
- im.setFocusable(true);
- im.requestFocus();
- im.setOnKeyListener(new View.OnKeyListener() {
@Override
- public boolean onKey(View v, int keyCode, KeyEvent event) {
- if (keyCode != KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) {
- ++mKeyCount;
- if (mKeyCount > 2) {
- if (mTapCount > 5) {
- im.performLongClick();
- } else {
- im.performClick();
+ public boolean onTouch(View v, MotionEvent event) {
+ switch (event.getActionMasked()) {
+ case MotionEvent.ACTION_DOWN:
+ case MotionEvent.ACTION_MOVE:
+ if (event.getPointerCount() > 1) {
+ event.getPointerCoords(0, pc0);
+ event.getPointerCoords(1, pc1);
+ bg.setRadius((float) Math.hypot(pc0.x - pc1.x, pc0.y - pc1.y) / 2f);
}
- }
- return true;
- } else {
- return false;
+ break;
}
+ return true;
}
});
+ }
+
+ @Override
+ public void onStart() {
+ super.onStart();
+
+ bg.randomizePalette();
- mLayout.addView(im, new FrameLayout.LayoutParams(size, size, Gravity.CENTER));
+ anim = new TimeAnimator();
+ anim.setTimeListener(
+ new TimeAnimator.TimeListener() {
+ @Override
+ public void onTimeUpdate(TimeAnimator animation, long totalTime, long deltaTime) {
+ bg.setOffset((float) totalTime / 60000f);
+ bg.invalidateSelf();
+ }
+ });
- im.animate().scaleX(1f).scaleY(1f).alpha(1f)
- .setInterpolator(mInterpolator)
- .setDuration(500)
- .setStartDelay(800)
- .start();
+ anim.start();
+ }
+
+ @Override
+ public void onStop() {
+ if (anim != null) {
+ anim.cancel();
+ anim = null;
+ }
+ super.onStop();
}
}
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index cf3e073a8cbb..ecab15fb81a5 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -3522,7 +3522,7 @@ public class BatteryStatsImpl extends BatteryStats {
mHistoryLastWritten.cmd = HistoryItem.CMD_NULL;
}
- void addHistoryBufferLocked(long elapsedRealtimeMs, long uptimeMs, HistoryItem cur) {
+ void addHistoryBufferLocked(long elapsedRealtimeMs, HistoryItem cur) {
if (!mHaveBatteryLevel || !mRecordingHistory) {
return;
}
@@ -3603,8 +3603,8 @@ public class BatteryStatsImpl extends BatteryStats {
} else if (dataSize >= MAX_HISTORY_BUFFER) {
if (!mHistoryOverflow) {
mHistoryOverflow = true;
- addHistoryBufferLocked(elapsedRealtimeMs, uptimeMs, HistoryItem.CMD_UPDATE, cur);
- addHistoryBufferLocked(elapsedRealtimeMs, uptimeMs, HistoryItem.CMD_OVERFLOW, cur);
+ addHistoryBufferLocked(elapsedRealtimeMs, HistoryItem.CMD_UPDATE, cur);
+ addHistoryBufferLocked(elapsedRealtimeMs, HistoryItem.CMD_OVERFLOW, cur);
return;
}
@@ -3642,7 +3642,7 @@ public class BatteryStatsImpl extends BatteryStats {
return;
}
- addHistoryBufferLocked(elapsedRealtimeMs, uptimeMs, HistoryItem.CMD_UPDATE, cur);
+ addHistoryBufferLocked(elapsedRealtimeMs, HistoryItem.CMD_UPDATE, cur);
return;
}
@@ -3650,15 +3650,14 @@ public class BatteryStatsImpl extends BatteryStats {
// The history is currently empty; we need it to start with a time stamp.
cur.currentTime = System.currentTimeMillis();
if (recordResetDueToOverflow) {
- addHistoryBufferLocked(elapsedRealtimeMs, uptimeMs, HistoryItem.CMD_OVERFLOW, cur);
+ addHistoryBufferLocked(elapsedRealtimeMs, HistoryItem.CMD_OVERFLOW, cur);
}
- addHistoryBufferLocked(elapsedRealtimeMs, uptimeMs, HistoryItem.CMD_RESET, cur);
+ addHistoryBufferLocked(elapsedRealtimeMs, HistoryItem.CMD_RESET, cur);
}
- addHistoryBufferLocked(elapsedRealtimeMs, uptimeMs, HistoryItem.CMD_UPDATE, cur);
+ addHistoryBufferLocked(elapsedRealtimeMs, HistoryItem.CMD_UPDATE, cur);
}
- private void addHistoryBufferLocked(long elapsedRealtimeMs, long uptimeMs, byte cmd,
- HistoryItem cur) {
+ private void addHistoryBufferLocked(long elapsedRealtimeMs, byte cmd, HistoryItem cur) {
if (mIteratingHistory) {
throw new IllegalStateException("Can't do this while iterating history!");
}
@@ -3692,17 +3691,17 @@ public class BatteryStatsImpl extends BatteryStats {
mHistoryAddTmp.wakeReasonTag = null;
mHistoryAddTmp.eventCode = HistoryItem.EVENT_NONE;
mHistoryAddTmp.states &= ~HistoryItem.STATE_CPU_RUNNING_FLAG;
- addHistoryRecordInnerLocked(wakeElapsedTime, uptimeMs, mHistoryAddTmp);
+ addHistoryRecordInnerLocked(wakeElapsedTime, mHistoryAddTmp);
}
}
mHistoryCur.states |= HistoryItem.STATE_CPU_RUNNING_FLAG;
mTrackRunningHistoryElapsedRealtime = elapsedRealtimeMs;
mTrackRunningHistoryUptime = uptimeMs;
- addHistoryRecordInnerLocked(elapsedRealtimeMs, uptimeMs, mHistoryCur);
+ addHistoryRecordInnerLocked(elapsedRealtimeMs, mHistoryCur);
}
- void addHistoryRecordInnerLocked(long elapsedRealtimeMs, long uptimeMs, HistoryItem cur) {
- addHistoryBufferLocked(elapsedRealtimeMs, uptimeMs, cur);
+ void addHistoryRecordInnerLocked(long elapsedRealtimeMs, HistoryItem cur) {
+ addHistoryBufferLocked(elapsedRealtimeMs, cur);
if (!USE_OLD_HISTORY) {
return;
@@ -3743,7 +3742,7 @@ public class BatteryStatsImpl extends BatteryStats {
if (mNumHistoryItems == MAX_HISTORY_ITEMS
|| mNumHistoryItems == MAX_MAX_HISTORY_ITEMS) {
- addHistoryBufferLocked(elapsedRealtimeMs, uptimeMs, HistoryItem.CMD_OVERFLOW, cur);
+ addHistoryBufferLocked(elapsedRealtimeMs, HistoryItem.CMD_OVERFLOW, cur);
}
if (mNumHistoryItems >= MAX_HISTORY_ITEMS) {
@@ -3760,7 +3759,7 @@ public class BatteryStatsImpl extends BatteryStats {
}
}
- addHistoryBufferLocked(elapsedRealtimeMs, uptimeMs, HistoryItem.CMD_UPDATE, cur);
+ addHistoryBufferLocked(elapsedRealtimeMs, HistoryItem.CMD_UPDATE, cur);
}
public void addHistoryEventLocked(long elapsedRealtimeMs, long uptimeMs, int code,
@@ -9931,8 +9930,6 @@ public class BatteryStatsImpl extends BatteryStats {
if (wl != null) {
StopwatchTimer wlt = getWakelockTimerLocked(wl, type);
wlt.stopRunningLocked(elapsedRealtimeMs);
- if (!wlt.isRunningLocked()) { // only tell statsd if truly stopped
- }
}
if (type == WAKE_TYPE_PARTIAL) {
if (mAggregatedPartialWakelockTimer != null) {
@@ -12307,7 +12304,7 @@ public class BatteryStatsImpl extends BatteryStats {
boolean reset) {
mRecordingHistory = true;
mHistoryCur.currentTime = System.currentTimeMillis();
- addHistoryBufferLocked(elapsedRealtimeMs, uptimeMs,
+ addHistoryBufferLocked(elapsedRealtimeMs,
reset ? HistoryItem.CMD_RESET : HistoryItem.CMD_CURRENT_TIME,
mHistoryCur);
mHistoryCur.currentTime = 0;
@@ -12320,8 +12317,7 @@ public class BatteryStatsImpl extends BatteryStats {
final long uptimeMs) {
if (mRecordingHistory) {
mHistoryCur.currentTime = currentTime;
- addHistoryBufferLocked(elapsedRealtimeMs, uptimeMs, HistoryItem.CMD_CURRENT_TIME,
- mHistoryCur);
+ addHistoryBufferLocked(elapsedRealtimeMs, HistoryItem.CMD_CURRENT_TIME, mHistoryCur);
mHistoryCur.currentTime = 0;
}
}
@@ -12329,8 +12325,7 @@ public class BatteryStatsImpl extends BatteryStats {
private void recordShutdownLocked(final long elapsedRealtimeMs, final long uptimeMs) {
if (mRecordingHistory) {
mHistoryCur.currentTime = System.currentTimeMillis();
- addHistoryBufferLocked(elapsedRealtimeMs, uptimeMs, HistoryItem.CMD_SHUTDOWN,
- mHistoryCur);
+ addHistoryBufferLocked(elapsedRealtimeMs, HistoryItem.CMD_SHUTDOWN, mHistoryCur);
mHistoryCur.currentTime = 0;
}
}
@@ -13274,7 +13269,7 @@ public class BatteryStatsImpl extends BatteryStats {
if (USE_OLD_HISTORY) {
addHistoryRecordLocked(elapsedRealtime, uptime, HistoryItem.CMD_START, mHistoryCur);
}
- addHistoryBufferLocked(elapsedRealtime, uptime, HistoryItem.CMD_START, mHistoryCur);
+ addHistoryBufferLocked(elapsedRealtime, HistoryItem.CMD_START, mHistoryCur);
startRecordingHistory(elapsedRealtime, uptime, false);
}
diff --git a/core/java/com/android/server/BootReceiver.java b/core/java/com/android/server/BootReceiver.java
index fb186693979d..efd98e2ba96b 100644
--- a/core/java/com/android/server/BootReceiver.java
+++ b/core/java/com/android/server/BootReceiver.java
@@ -164,7 +164,7 @@ public class BootReceiver extends BroadcastReceiver {
.append("Revision: ")
.append(SystemProperties.get("ro.revision", "")).append("\n")
.append("Bootloader: ").append(Build.BOOTLOADER).append("\n")
- .append("Radio: ").append(Build.RADIO).append("\n")
+ .append("Radio: ").append(Build.getRadioVersion()).append("\n")
.append("Kernel: ")
.append(FileUtils.readTextFile(new File("/proc/version"), 1024, "...\n"))
.append("\n").toString();
diff --git a/core/jni/android_util_Binder.cpp b/core/jni/android_util_Binder.cpp
index 1350f3f46aca..5b788a644852 100644
--- a/core/jni/android_util_Binder.cpp
+++ b/core/jni/android_util_Binder.cpp
@@ -673,7 +673,7 @@ jobject javaObjectForIBinder(JNIEnv* env, const sp<IBinder>& val)
nativeData->mObject = val;
gNativeDataCache = nullptr;
++gNumProxies;
- if (++gNumProxies >= gProxiesWarned + PROXY_WARN_INTERVAL) {
+ if (gNumProxies >= gProxiesWarned + PROXY_WARN_INTERVAL) {
ALOGW("Unexpectedly many live BinderProxies: %d\n", gNumProxies);
gProxiesWarned = gNumProxies;
}
diff --git a/core/res/res/drawable-nodpi/platlogo.xml b/core/res/res/drawable-nodpi/platlogo.xml
index a6dee8a9beb3..f5bbadcce06b 100644
--- a/core/res/res/drawable-nodpi/platlogo.xml
+++ b/core/res/res/drawable-nodpi/platlogo.xml
@@ -1,6 +1,5 @@
-<?xml version="1.0" encoding="utf-8"?>
<!--
-Copyright (C) 2017 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.
@@ -14,36 +13,21 @@ Copyright (C) 2017 The Android Open Source Project
See the License for the specific language governing permissions and
limitations under the License.
-->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="48dp"
- android:height="48dp"
- android:viewportWidth="48"
- android:viewportHeight="48">
- <group>
- <path
- android:fillColor="#2C292A"
- android:fillType="evenOdd"
- android:pathData="M6,26a20,20 0 0,1 40,0a20,20 0 0,1 -40,0z"/>
- <path
- android:fillColor="#FAFAFA"
- android:fillType="evenOdd"
- android:pathData="M4,24a20,20 0 0,1 40,0a20,20 0 0,1 -40,0z"/>
- <path
- android:fillColor="#2C292A"
- android:fillType="evenOdd"
- android:pathData="M2,22a20,20 0 0,1 40,0a20,20 0 0,1 -40,0z"/>
- <path
- android:fillColor="#00000000"
- android:strokeColor="#453F41"
- android:strokeWidth="1"
- android:fillType="evenOdd"
- android:pathData="M26.5 29.5v3c0 1.13-.87 2-2 2s-2-.87-2-2v-3h-1v3c0 1.13-.87 2-2 2s-2-.87-2-2v-3H17a1.5 1.5 0 0 1-1.5-1.5V17.5h13V28a1.5 1.5 0 0 1-1.5 1.5h-.5zM13.5 17.5c1.13 0 2 .87 2 2v7c0 1.13-.87 2-2 2s-2-.87-2-2v-7c0-1.13.87-2 2-2zM30.5 17.5c1.13 0 2 .87 2 2v7c0 1.13-.87 2-2 2s-2-.87-2-2v-7c0-1.13.87-2 2-2zM26.3 12.11A6.46 6.46 0 0 1 28.5 17v.5h-13V17a6.46 6.46 0 0 1 2.2-4.89l-.9-.9a.98.98 0 0 1 0-1.41.98.98 0 0 1 1.4 0l1.26 1.25A6.33 6.33 0 0 1 22 10.5c.87 0 1.73.2 2.54.55L25.8 9.8a.98.98 0 0 1 1.4 0 .98.98 0 0 1 0 1.4l-.9.91z"/>
- <path
- android:fillColor="#453F41"
- android:fillType="evenOdd"
- android:pathData="M20.16 14.5a.66.66 0 1 1-1.31 0c0-.36.29-.65.65-.65.36 0 .65.29.65.65zM25.16 14.5c0 .36-.3.66-.66.66a.65.65 0 1 1 .66-.66z"/>
- <path
- android:fillColor="#453F41"
- android:pathData="M22 40.5c0.36 0 0.73-0.01 1.09-0.03l-0.18-3A15.77 15.77 0 0 1 22 37.5v3zm2.17-0.13a18.48 18.48 0 0 0 1.08-0.15l-0.53-2.96c-0.3 0.05-0.6 0.1-0.9 0.13l0.35 2.98zM26.32 40a18.37 18.37 0 0 0 1.05-0.28l-0.87-2.87a15.37 15.37 0 0 1-0.88 0.23l0.7 2.92zm2.1-0.64l-1.03-2.81a15.39 15.39 0 0 0 0.84-0.34l1.2 2.74a18.39 18.39 0 0 1-1 0.41zm1.99-0.87l-1.37-2.67a15.46 15.46 0 0 0 0.8-0.44l1.52 2.59a18.46 18.46 0 0 1-0.95 0.52zm1.89-1.11l-1.67-2.5a15.55 15.55 0 0 0 0.74-0.52l1.81 2.39a18.55 18.55 0 0 1-0.88 0.63zm1.75-1.33l-1.95-2.28a15.6 15.6 0 0 0 0.67-0.61l2.09 2.15a18.6 18.6 0 0 1-0.8 0.74zm1.6-1.55l-2.22-2.02a15.6 15.6 0 0 0 0.6-0.7l2.33 1.9a18.6 18.6 0 0 1-0.72 0.82zM37 32.82l-2.43-1.76a15.53 15.53 0 0 0 0.5-0.75l2.54 1.6c-0.2 0.31-0.4 0.61-0.61 0.9zm1.15-1.8l-2.62-1.47a15.45 15.45 0 0 0 0.42-0.8l2.7 1.3a18.45 18.45 0 0 1-0.5 0.97zm0.95-1.98l-2.77-1.14a15.38 15.38 0 0 0 0.32-0.86l2.84 0.98a18.38 18.38 0 0 1-0.39 1.02zm0.72-2.09c0.1-0.34 0.18-0.7 0.26-1.05l-2.93-0.63a15.38 15.38 0 0 1-0.22 0.88l2.89 0.8zm0.46-2.15a18.52 18.52 0 0 0 0.13-1.08l-2.99-0.28a15.52 15.52 0 0 1-0.1 0.9l2.96 0.46zm0.2-2.2a18.81 18.81 0 0 0 0-1.1l-3 0.08a16 16 0 0 1 0 0.92l3 0.1zm-0.06-2.2a18.54 18.54 0 0 0-0.12-1.07l-2.97 0.43c0.04 0.3 0.08 0.6 0.1 0.9l3-0.25zm-0.31-2.15a18.39 18.39 0 0 0-0.25-1.06l-2.9 0.78a15.39 15.39 0 0 1 0.21 0.89l2.94-0.6zm-0.57-2.12l-2.85 0.95a15.37 15.37 0 0 0-0.31-0.85l2.78-1.12a18.37 18.37 0 0 1 0.38 1.02zm-0.83-2.06l-2.71 1.29a15.44 15.44 0 0 0-0.42-0.81l2.63-1.45a18.44 18.44 0 0 1 0.5 0.97zm-1.03-1.88l-2.54 1.6a15.53 15.53 0 0 0-0.5-0.76l2.44-1.74 0.6 0.9zm-1.28-1.79l-2.33 1.88a15.6 15.6 0 0 0-0.6-0.69l2.23-2.02a18.6 18.6 0 0 1 0.7 0.83zm-1.48-1.63l-2.1 2.14a15.6 15.6 0 0 0-0.67-0.62l1.97-2.26a18.6 18.6 0 0 1 0.8 0.74zM33.24 7.3l-1.82 2.38a15.55 15.55 0 0 0-0.74-0.53l1.68-2.49c0.3 0.2 0.6 0.42 0.88 0.64zm-1.71-1.17L29.98 8.7a15.47 15.47 0 0 0-0.8-0.45l1.4-2.66a18.47 18.47 0 0 1 0.95 0.54zm-1.95-1.02l-1.23 2.74A15.4 15.4 0 0 0 27.5 7.5l1.06-2.8a18.4 18.4 0 0 1 1.01 0.4zm-2.06-0.78l-0.9 2.86a15.37 15.37 0 0 0-0.87-0.24l0.72-2.92a18.37 18.37 0 0 1 1.05 0.3zM25.38 3.8a18.47 18.47 0 0 0-1.08-0.17l-0.37 2.98c0.3 0.04 0.6 0.08 0.9 0.14l0.55-2.95zm-2.2-0.27A18.75 18.75 0 0 0 22.1 3.5l-0.02 3L23 6.53l0.19-3zM21 3.53a18.6 18.6 0 0 0-1.08 0.09l0.33 2.98a15.6 15.6 0 0 1 0.91-0.08l-0.16-3zm-2.16 0.24A18.4 18.4 0 0 0 17.76 4l0.68 2.92a15.4 15.4 0 0 1 0.9-0.18l-0.51-2.96zm-2.14 0.5l0.86 2.88a15.37 15.37 0 0 0-0.86 0.28l-1.03-2.81a18.37 18.37 0 0 1 1.03-0.35zm-2.07 0.76l1.2 2.75a15.42 15.42 0 0 0-0.83 0.4L13.63 5.5a18.42 18.42 0 0 1 0.99-0.47zM12.7 6l1.5 2.6a15.5 15.5 0 0 0-0.76 0.48l-1.66-2.5A18.5 18.5 0 0 1 12.7 6zm-1.83 1.22l1.8 2.4a15.58 15.58 0 0 0-0.7 0.57L10.01 7.9a18.58 18.58 0 0 1 0.85-0.68zM9.19 8.66l2.07 2.16a15.6 15.6 0 0 0-0.63 0.65l-2.2-2.04a18.6 18.6 0 0 1 0.76-0.77zm-1.51 1.63l2.32 1.9a15.57 15.57 0 0 0-0.56 0.72l-2.42-1.76a18.57 18.57 0 0 1 0.66-0.86zm-1.23 1.69l2.52 1.62a15.5 15.5 0 0 0-0.47 0.78l-2.61-1.47a18.5 18.5 0 0 1 0.56-0.93zm-1.08 1.9l2.7 1.32a15.41 15.41 0 0 0-0.38 0.83l-2.77-1.15a18.41 18.41 0 0 1 0.45-1zm-0.85 2.04l2.84 0.98a15.37 15.37 0 0 0-0.28 0.87L4.2 16.96c0.1-0.35 0.2-0.7 0.32-1.04zm-0.6 2.12a18.43 18.43 0 0 0-0.2 1.07l2.97 0.47c0.05-0.3 0.1-0.6 0.17-0.9l-2.93-0.64zm-0.34 2.18a18.65 18.65 0 0 0-0.07 1.09l3 0.11 0.06-0.91-2.99-0.29zm-0.08 2.2a18.7 18.7 0 0 0 0.06 1.1l3-0.25a15.7 15.7 0 0 1-0.06-0.91l-3 0.07zm0.18 2.18a18.44 18.44 0 0 0 0.18 1.07l2.95-0.6a15.44 15.44 0 0 1-0.16-0.9L3.68 24.6zm0.43 2.14l2.9-0.77a15.37 15.37 0 0 0 0.26 0.88l-2.85 0.94a18.37 18.37 0 0 1-0.3-1.05zm0.7 2.1l2.78-1.11a15.4 15.4 0 0 0 0.36 0.83l-2.71 1.27a18.4 18.4 0 0 1-0.44-1zm0.9 1.95l2.65-1.43a15.48 15.48 0 0 0 0.45 0.8l-2.55 1.57a18.48 18.48 0 0 1-0.54-0.94zm1.17 1.87l2.45-1.73a15.56 15.56 0 0 0 0.54 0.73l-2.34 1.87a18.56 18.56 0 0 1-0.65-0.87zm1.37 1.72l2.23-2a15.6 15.6 0 0 0 0.63 0.65l-2.1 2.14a18.6 18.6 0 0 1-0.76-0.79zm1.58 1.56l1.98-2.26c0.22 0.2 0.46 0.39 0.7 0.58l-1.84 2.37a18.59 18.59 0 0 1-0.84-0.7zm1.66 1.28l1.7-2.46a15.52 15.52 0 0 0 0.77 0.5l-1.56 2.56a18.52 18.52 0 0 1-0.91-0.6zm1.87 1.14l1.4-2.65a15.43 15.43 0 0 0 0.82 0.4l-1.24 2.73a18.43 18.43 0 0 1-0.98-0.48zm2 0.91l1.08-2.8a15.37 15.37 0 0 0 0.86 0.3l-0.9 2.86a18.37 18.37 0 0 1-1.04-0.36zm2.1 0.67a18.4 18.4 0 0 0 1.07 0.23l0.56-2.94a15.4 15.4 0 0 1-0.9-0.2l-0.72 2.91zm2.18 0.41a18.57 18.57 0 0 0 1.08 0.1l0.2-2.99a15.57 15.57 0 0 1-0.9-0.09l-0.38 2.98zm2.2 0.15H22v-3h-0.13l-0.03 3z"/>
- </group>
+<vector
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:name="vector"
+ android:width="640dp"
+ android:height="640dp"
+ android:viewportWidth="64"
+ android:viewportHeight="64">
+ <path
+ android:name="bg"
+ android:pathData="M 27 43 L 32 43 C 38.075 43 43 38.075 43 32 C 43 25.925 38.075 21 32 21 C 25.925 21 21 25.925 21 32 L 21 64"
+ android:strokeColor="#6823a1"
+ android:strokeWidth="16"/>
+ <path
+ android:name="fg"
+ android:pathData="M 29 43 L 32 43 C 38.075 43 43 38.075 43 32 C 43 25.925 38.075 21 32 21 C 25.925 21 21 25.925 21 32 L 21 64"
+ android:strokeColor="#ff0000"
+ android:strokeWidth="8"/>
</vector>
diff --git a/core/res/res/drawable-nodpi/platlogo_m.xml b/core/res/res/drawable-nodpi/platlogo_m.xml
index aacf67483d72..8e43638ef221 100644
--- a/core/res/res/drawable-nodpi/platlogo_m.xml
+++ b/core/res/res/drawable-nodpi/platlogo_m.xml
@@ -18,23 +18,4 @@ Copyright (C) 2017 The Android Open Source Project
android:height="480dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
- <!--<path
- android:pathData="M25.0,25.0m-20.5,0.0a20.5,20.5,0,1,1,41.0,0.0a20.5,20.5,0,1,1,-41.0,0.0"
- android:fillAlpha="0.066"
- android:fillColor="#000000"/>-->
- <path
- android:pathData="M24.0,24.0m-20.0,0.0a20.0,20.0,0,1,1,40.0,0.0a20.0,20.0,0,1,1,-40.0,0.0"
- android:fillColor="#FFC107"/>
- <path
- android:pathData="M44,24.2010101 L33.9004889,14.101499 L14.101499,33.9004889 L24.2010101,44 C29.2525804,43.9497929 34.2887564,41.9975027 38.1431296,38.1431296 C41.9975027,34.2887564 43.9497929,29.2525804 44,24.2010101 Z"
- android:fillColor="#FE9F00"/>
- <path
- android:pathData="M24.0,24.0m-14.0,0.0a14.0,14.0,0,1,1,28.0,0.0a14.0,14.0,0,1,1,-28.0,0.0"
- android:fillColor="#FED44F"/>
- <path
- android:pathData="M37.7829445,26.469236 L29.6578482,18.3441397 L18.3441397,29.6578482 L26.469236,37.7829445 C29.1911841,37.2979273 31.7972024,36.0037754 33.9004889,33.9004889 C36.0037754,31.7972024 37.2979273,29.1911841 37.7829445,26.469236 Z"
- android:fillColor="#FFC107"/>
- <path
- android:pathData="M24.0,24.0m-8.0,0.0a8.0,8.0,0,1,1,16.0,0.0a8.0,8.0,0,1,1,-16.0,0.0"
- android:fillColor="#FFFFFF"/>
</vector>
diff --git a/core/res/res/drawable-nodpi/stat_sys_adb.xml b/core/res/res/drawable-nodpi/stat_sys_adb.xml
index 2e2b3956dc68..0fde2cc2aba4 100644
--- a/core/res/res/drawable-nodpi/stat_sys_adb.xml
+++ b/core/res/res/drawable-nodpi/stat_sys_adb.xml
@@ -1,6 +1,5 @@
-<?xml version="1.0" encoding="utf-8"?>
<!--
-Copyright (C) 2017 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.
@@ -14,24 +13,24 @@ Copyright (C) 2017 The Android Open Source Project
See the License for the specific language governing permissions and
limitations under the License.
-->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24dp"
- android:height="24dp"
- android:viewportWidth="24"
- android:viewportHeight="24">
- <group>
+<vector
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:name="vector"
+ android:width="48dp"
+ android:height="48dp"
+ android:viewportWidth="48"
+ android:viewportHeight="48">
+ <group android:name="stat_sys_adb">
<path
- android:fillColor="#FFFFFF"
- android:fillAlpha=".33"
- android:fillType="evenOdd"
- android:pathData="M5.71 18.29A8.99 8.99 0 0 0 22 13c0-3-1.46-5.65-3.71-7.29A8.99 8.99 0 0 0 2 11c0 3 1.46 5.65 3.71 7.29z"/>
+ android:name="outer"
+ android:pathData="M 18 30 L 24 30 C 29.523 30 34 25.523 34 20 C 34 14.477 29.523 10 24 10 C 18.477 10 14 14.477 14 20 L 14 44"
+ android:strokeColor="#000000"
+ android:strokeWidth="10"/>
<path
- android:fillColor="#FFFFFF"
- android:fillType="evenOdd"
- android:pathData="M7.25 19.18A8.5 8.5 0 0 0 19.19 7.24 9 9 0 0 1 7.24 19.19z"/>
- <path
- android:fillColor="#FFFFFF"
- android:fillAlpha=".33"
- android:pathData="M10.5 3a0.5 0.5 0 1 1 1 0v2.05a0.5 0.5 0 1 1-1 0V3zm3.1 0.42a0.5 0.5 0 0 1 0.93 0.39l-0.8 1.88A0.5 0.5 0 1 1 12.8 5.3l0.8-1.88zm2.7 1.57a0.5 0.5 0 1 1 0.71 0.7l-1.45 1.46a0.5 0.5 0 0 1-0.7-0.71l1.44-1.45zm1.9 2.5a0.5 0.5 0 0 1 0.38 0.92l-1.9 0.77a0.5 0.5 0 0 1-0.37-0.93l1.9-0.77zM19 10.5a0.5 0.5 0 1 1 0 1h-2.05a0.5 0.5 0 0 1 0-1H19zm-0.42 3.1a0.5 0.5 0 0 1-0.39 0.93l-1.88-0.8a0.5 0.5 0 1 1 0.39-0.92l1.88 0.8zm-1.57 2.7a0.5 0.5 0 1 1-0.7 0.71l-1.46-1.45a0.5 0.5 0 0 1 0.71-0.7l1.45 1.44zm-2.5 1.9a0.5 0.5 0 1 1-0.92 0.38l-0.77-1.9a0.5 0.5 0 0 1 0.93-0.37l0.77 1.9zM11.5 19a0.5 0.5 0 1 1-1 0v-2.05a0.5 0.5 0 0 1 1 0V19zm-3.1-0.42a0.5 0.5 0 0 1-0.93-0.39l0.8-1.88A0.5 0.5 0 0 1 9.2 16.7l-0.8 1.88zm-2.7-1.57a0.5 0.5 0 1 1-0.71-0.7l1.45-1.46a0.5 0.5 0 0 1 0.7 0.71L5.7 17.01zm-1.9-2.48a0.5 0.5 0 0 1-0.38-0.92l1.88-0.8a0.5 0.5 0 0 1 0.4 0.92l-1.9 0.8zM3 11.5a0.5 0.5 0 1 1 0-1h2.05a0.5 0.5 0 1 1 0 1H3zm0.42-3.1A0.5 0.5 0 0 1 3.8 7.46l1.88 0.8A0.5 0.5 0 1 1 5.3 9.2L3.42 8.4zm1.57-2.7a0.5 0.5 0 1 1 0.7-0.71l1.46 1.45a0.5 0.5 0 0 1-0.71 0.7L4.99 5.7zm2.5-1.9A0.5 0.5 0 0 1 8.4 3.41l0.77 1.9a0.5 0.5 0 0 1-0.93 0.37L7.48 3.8z"/>
+ android:name="inner"
+ android:pathData="M 19 30 L 24 30 C 29.523 30 34 25.523 34 20 C 34 14.477 29.523 10 24 10 C 18.477 10 14 14.477 14 20 L 14 44"
+ android:strokeColor="#000000"
+ android:strokeAlpha="0"
+ android:strokeWidth="6"/>
</group>
-</vector> \ No newline at end of file
+</vector>
diff --git a/core/tests/coretests/src/android/provider/SettingsBackupTest.java b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
index 05c12ae30732..853a36d29745 100644
--- a/core/tests/coretests/src/android/provider/SettingsBackupTest.java
+++ b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
@@ -389,7 +389,6 @@ public class SettingsBackupTest {
Settings.Global.TZINFO_UPDATE_METADATA_URL,
Settings.Global.INSTALLED_INSTANT_APP_MIN_CACHE_PERIOD,
Settings.Global.INSTALLED_INSTANT_APP_MAX_CACHE_PERIOD,
- Settings.Global.UID_CPUPOWER,
Settings.Global.UNINSTALLED_INSTANT_APP_MIN_CACHE_PERIOD,
Settings.Global.UNINSTALLED_INSTANT_APP_MAX_CACHE_PERIOD,
Settings.Global.UNUSED_STATIC_SHARED_LIB_MIN_CACHE_PERIOD,
diff --git a/data/etc/privapp-permissions-platform.xml b/data/etc/privapp-permissions-platform.xml
index bb9b89be9edb..3495b84e0ab9 100644
--- a/data/etc/privapp-permissions-platform.xml
+++ b/data/etc/privapp-permissions-platform.xml
@@ -158,7 +158,6 @@ applications that come with the platform
<permission name="android.permission.LOCAL_MAC_ADDRESS"/>
<permission name="android.permission.MANAGE_USERS"/>
<permission name="android.permission.MODIFY_PHONE_STATE"/>
- <permission name="android.permission.PACKAGE_USAGE_STATS"/>
<permission name="android.permission.PERFORM_CDMA_PROVISIONING"/>
<permission name="android.permission.READ_NETWORK_USAGE_HISTORY"/>
<permission name="android.permission.READ_PRIVILEGED_PHONE_STATE"/>
diff --git a/graphics/java/android/graphics/drawable/Drawable.java b/graphics/java/android/graphics/drawable/Drawable.java
index 36a4d26d62bb..44ba78557678 100644
--- a/graphics/java/android/graphics/drawable/Drawable.java
+++ b/graphics/java/android/graphics/drawable/Drawable.java
@@ -1171,6 +1171,8 @@ public abstract class Drawable {
/**
* Create a drawable from an inputstream, using the given resources and
* value to determine density information.
+ *
+ * @deprecated Prefer the version without an Options object.
*/
public static Drawable createFromResourceStream(Resources res, TypedValue value,
InputStream is, String srcName, BitmapFactory.Options opts) {
diff --git a/media/java/android/media/VolumePolicy.java b/media/java/android/media/VolumePolicy.java
index bbcce82f2e2d..bd6667faff31 100644
--- a/media/java/android/media/VolumePolicy.java
+++ b/media/java/android/media/VolumePolicy.java
@@ -23,7 +23,7 @@ import java.util.Objects;
/** @hide */
public final class VolumePolicy implements Parcelable {
- public static final VolumePolicy DEFAULT = new VolumePolicy(false, false, true, 400);
+ public static final VolumePolicy DEFAULT = new VolumePolicy(false, false, false, 400);
/**
* Accessibility volume policy where the STREAM_MUSIC volume (i.e. media volume) affects
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothAdapter.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothAdapter.java
index cda4e454fe74..5f7ba586fbad 100755..100644
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothAdapter.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothAdapter.java
@@ -194,8 +194,13 @@ public class LocalBluetoothAdapter {
return mState;
}
- synchronized void setBluetoothStateInt(int state) {
- mState = state;
+ void setBluetoothStateInt(int state) {
+ synchronized(this) {
+ if (mState == state) {
+ return;
+ }
+ mState = state;
+ }
if (state == BluetoothAdapter.STATE_ON) {
// if mProfileManager hasn't been constructed yet, it will
diff --git a/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPointPreference.java b/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPointPreference.java
index 109eb97ed2d8..8115ede2729e 100644
--- a/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPointPreference.java
+++ b/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPointPreference.java
@@ -41,7 +41,7 @@ import com.android.settingslib.TwoTargetPreference;
import com.android.settingslib.Utils;
import com.android.settingslib.wifi.AccessPoint.Speed;
-public class AccessPointPreference extends TwoTargetPreference {
+public class AccessPointPreference extends Preference {
private static final int[] STATE_SECURED = {
R.attr.state_encrypted
@@ -115,6 +115,7 @@ public class AccessPointPreference extends TwoTargetPreference {
int iconResId, boolean forSavedNetworks, StateListDrawable frictionSld,
int level, IconInjector iconInjector) {
super(context);
+ setWidgetLayoutResource(R.layout.access_point_friction_widget);
mBadgeCache = cache;
mAccessPoint = accessPoint;
mForSavedNetworks = forSavedNetworks;
@@ -153,20 +154,6 @@ public class AccessPointPreference extends TwoTargetPreference {
ImageView frictionImageView = (ImageView) view.findViewById(R.id.friction_icon);
bindFrictionImage(frictionImageView);
- setDividerVisibility(view, View.GONE);
- }
-
- protected void setDividerVisibility(final PreferenceViewHolder view,
- @View.Visibility int visibility) {
- final View divider = view.findViewById(R.id.two_target_divider);
- if (divider != null) {
- divider.setVisibility(visibility);
- }
- }
-
- @Override
- protected int getSecondTargetResId() {
- return R.layout.access_point_friction_widget;
}
protected void updateIcon(int level, Context context) {
diff --git a/packages/SystemUI/res/layout/recents_swipe_up_onboarding.xml b/packages/SystemUI/res/layout/recents_onboarding.xml
index b3d5c9008039..12f278a204c7 100644
--- a/packages/SystemUI/res/layout/recents_swipe_up_onboarding.xml
+++ b/packages/SystemUI/res/layout/recents_onboarding.xml
@@ -30,7 +30,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
- android:text="@string/recents_swipe_up_onboarding"
android:textColor="@android:color/white"
android:textSize="16sp"
android:drawableBottom="@drawable/ic_chevron_up"/>
diff --git a/packages/SystemUI/res/values/ids.xml b/packages/SystemUI/res/values/ids.xml
index d741cc8bda8e..2d30f4c0082d 100644
--- a/packages/SystemUI/res/values/ids.xml
+++ b/packages/SystemUI/res/values/ids.xml
@@ -47,7 +47,6 @@
<item type="id" name="qs_icon_tag"/>
<item type="id" name="qs_slash_tag"/>
<item type="id" name="scrim"/>
- <item type="id" name="scrim_blanking"/>
<item type="id" name="scrim_target"/>
<item type="id" name="scrim_alpha_start"/>
<item type="id" name="scrim_alpha_end"/>
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index fadcbcd4f4bc..fc5ea4581a01 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -842,8 +842,6 @@
<string name="recents_stack_action_button_label">Clear all</string>
<!-- Recents: Hint text that shows on the drop targets to start multiwindow. [CHAR LIMIT=NONE] -->
<string name="recents_drag_hint_message">Drag here to use split screen</string>
- <!-- Recents: Text that shows above the nav bar after launching a few apps. [CHAR LIMIT=NONE] -->
- <string name="recents_swipe_up_onboarding">Swipe up to switch apps</string>
<!-- Recents: MultiStack add stack split horizontal radio button. [CHAR LIMIT=NONE] -->
<string name="recents_multistack_add_stack_dialog_split_horizontal">Split Horizontal</string>
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl
index 98ede4eafbe2..4cf817e02fff 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl
@@ -39,4 +39,9 @@ interface ISystemUiProxy {
* Called when the overview service has started the recents animation.
*/
void onRecentsAnimationStarted();
+
+ /**
+ * Specifies the text to be shown for onboarding the new swipe-up gesture to access recents.
+ */
+ void setRecentsOnboardingText(CharSequence text);
}
diff --git a/packages/SystemUI/src/com/android/systemui/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/OverviewProxyService.java
index b7e1d67a5b3a..b30b0c575415 100644
--- a/packages/SystemUI/src/com/android/systemui/OverviewProxyService.java
+++ b/packages/SystemUI/src/com/android/systemui/OverviewProxyService.java
@@ -66,6 +66,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
private IOverviewProxy mOverviewProxy;
private int mConnectionBackoffAttempts;
+ private CharSequence mOnboardingText;
private ISystemUiProxy mSysUiProxy = new ISystemUiProxy.Stub() {
@@ -105,6 +106,10 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
Binder.restoreCallingIdentity(token);
}
}
+
+ public void setRecentsOnboardingText(CharSequence text) {
+ mOnboardingText = text;
+ }
};
private final BroadcastReceiver mLauncherAddedReceiver = new BroadcastReceiver() {
@@ -223,8 +228,8 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
return mOverviewProxy;
}
- public ComponentName getLauncherComponent() {
- return mLauncherComponentName;
+ public CharSequence getOnboardingText() {
+ return mOnboardingText;
}
private void disconnectFromLauncherService() {
diff --git a/packages/SystemUI/src/com/android/systemui/Prefs.java b/packages/SystemUI/src/com/android/systemui/Prefs.java
index 9319bc60f9ef..adb4e33d1a19 100644
--- a/packages/SystemUI/src/com/android/systemui/Prefs.java
+++ b/packages/SystemUI/src/com/android/systemui/Prefs.java
@@ -49,7 +49,7 @@ public final class Prefs {
Key.QS_NIGHTDISPLAY_ADDED,
Key.SEEN_MULTI_USER,
Key.NUM_APPS_LAUNCHED,
- Key.HAS_SWIPED_UP_FOR_RECENTS,
+ Key.HAS_SEEN_RECENTS_ONBOARDING,
})
public @interface Key {
@Deprecated
@@ -78,7 +78,7 @@ public final class Prefs {
String QS_NIGHTDISPLAY_ADDED = "QsNightDisplayAdded";
String SEEN_MULTI_USER = "HasSeenMultiUser";
String NUM_APPS_LAUNCHED = "NumAppsLaunched";
- String HAS_SWIPED_UP_FOR_RECENTS = "HasSwipedUpForRecents";
+ String HAS_SEEN_RECENTS_ONBOARDING = "HasSeenRecentsOnboarding";
}
public static boolean getBoolean(Context context, @Key String key, boolean defaultValue) {
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/NightDisplayTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/NightDisplayTile.java
index ea6e174d786e..3597929229e6 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/NightDisplayTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/NightDisplayTile.java
@@ -21,6 +21,7 @@ import android.app.ActivityManager;
import android.content.Intent;
import android.provider.Settings;
import android.service.quicksettings.Tile;
+import android.support.annotation.StringRes;
import android.widget.Switch;
import com.android.internal.app.ColorDisplayController;
@@ -30,6 +31,7 @@ import com.android.systemui.qs.QSHost;
import com.android.systemui.plugins.qs.QSTile.BooleanState;
import com.android.systemui.qs.tileimpl.QSTileImpl;
+import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
public class NightDisplayTile extends QSTileImpl<BooleanState>
@@ -39,7 +41,9 @@ public class NightDisplayTile extends QSTileImpl<BooleanState>
* Pattern for {@link java.time.format.DateTimeFormatter} used to approximate the time to the
* nearest hour and add on the AM/PM indicator.
*/
- private static final String APPROXIMATE_HOUR_DATE_TIME_PATTERN = "h a";
+ private static final String HOUR_MINUTE_DATE_TIME_PATTERN = "h a";
+ private static final String APPROXIMATE_HOUR_DATE_TIME_PATTERN = "h:m a";
+
private ColorDisplayController mController;
private boolean mIsListening;
@@ -110,17 +114,26 @@ public class NightDisplayTile extends QSTileImpl<BooleanState>
case ColorDisplayController.AUTO_MODE_CUSTOM:
// User-specified time, approximated to the nearest hour.
- return isNightLightActivated
- ? mContext.getString(
- R.string.quick_settings_night_secondary_label_until,
- mController.getCustomEndTime().format(
- DateTimeFormatter.ofPattern(
- APPROXIMATE_HOUR_DATE_TIME_PATTERN)))
- : mContext.getString(
- R.string.quick_settings_night_secondary_label_on_at,
- mController.getCustomStartTime().format(
- DateTimeFormatter.ofPattern(
- APPROXIMATE_HOUR_DATE_TIME_PATTERN)));
+ final @StringRes int toggleTimeStringRes;
+ final LocalTime toggleTime;
+ final DateTimeFormatter toggleTimeFormat;
+
+ if (isNightLightActivated) {
+ toggleTime = mController.getCustomEndTime();
+ toggleTimeStringRes = R.string.quick_settings_night_secondary_label_until;
+ } else {
+ toggleTime = mController.getCustomStartTime();
+ toggleTimeStringRes = R.string.quick_settings_night_secondary_label_on_at;
+ }
+
+ // Choose between just showing the hour or also showing the minutes (based on the
+ // user-selected toggle time). This helps reduce how much space the label takes.
+ toggleTimeFormat = DateTimeFormatter.ofPattern(
+ toggleTime.getMinute() == 0
+ ? HOUR_MINUTE_DATE_TIME_PATTERN
+ : APPROXIMATE_HOUR_DATE_TIME_PATTERN);
+
+ return mContext.getString(toggleTimeStringRes, toggleTime.format(toggleTimeFormat));
default:
// No secondary label when auto mode is disabled.
diff --git a/packages/SystemUI/src/com/android/systemui/recents/SwipeUpOnboarding.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsOnboarding.java
index b2472bf73874..0ff8b085f035 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/SwipeUpOnboarding.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsOnboarding.java
@@ -16,13 +16,11 @@
package com.android.systemui.recents;
-import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
import android.annotation.TargetApi;
import android.app.ActivityManager;
-import android.content.ComponentName;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
@@ -31,6 +29,8 @@ import android.graphics.PorterDuff;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.RippleDrawable;
import android.os.Build;
+import android.text.TextUtils;
+import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
@@ -41,6 +41,7 @@ import android.view.animation.DecelerateInterpolator;
import android.widget.ImageView;
import android.widget.TextView;
+import com.android.systemui.OverviewProxyService;
import com.android.systemui.Prefs;
import com.android.systemui.R;
import com.android.systemui.recents.misc.SysUiTaskStackChangeListener;
@@ -50,9 +51,9 @@ import com.android.systemui.shared.system.ActivityManagerWrapper;
* Shows onboarding for the new recents interaction in P (codenamed quickstep).
*/
@TargetApi(Build.VERSION_CODES.P)
-public class SwipeUpOnboarding {
+public class RecentsOnboarding {
- private static final String TAG = "SwipeUpOnboarding";
+ private static final String TAG = "RecentsOnboarding";
private static final boolean RESET_PREFS_FOR_DEBUG = false;
private static final long SHOW_DELAY_MS = 500;
private static final long SHOW_HIDE_DURATION_MS = 300;
@@ -61,6 +62,7 @@ public class SwipeUpOnboarding {
private final Context mContext;
private final WindowManager mWindowManager;
+ private final OverviewProxyService mOverviewProxyService;
private final View mLayout;
private final TextView mTextView;
private final ImageView mDismissView;
@@ -113,11 +115,12 @@ public class SwipeUpOnboarding {
}
};
- public SwipeUpOnboarding(Context context) {
+ public RecentsOnboarding(Context context, OverviewProxyService overviewProxyService) {
mContext = context;
+ mOverviewProxyService = overviewProxyService;
final Resources res = context.getResources();
mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
- mLayout = LayoutInflater.from(mContext).inflate(R.layout.recents_swipe_up_onboarding, null);
+ mLayout = LayoutInflater.from(mContext).inflate(R.layout.recents_onboarding, null);
mTextView = mLayout.findViewById(R.id.onboarding_text);
mDismissView = mLayout.findViewById(R.id.dismiss);
mDarkBackgroundColor = res.getColor(android.R.color.background_dark);
@@ -135,25 +138,25 @@ public class SwipeUpOnboarding {
mDismissView.setOnClickListener(v -> hide(true));
if (RESET_PREFS_FOR_DEBUG) {
- Prefs.putBoolean(mContext, Prefs.Key.HAS_SWIPED_UP_FOR_RECENTS, false);
+ Prefs.putBoolean(mContext, Prefs.Key.HAS_SEEN_RECENTS_ONBOARDING, false);
Prefs.putInt(mContext, Prefs.Key.NUM_APPS_LAUNCHED, 0);
}
}
public void onConnectedToLauncher() {
- boolean alreadyLearnedSwipeUpForRecents = Prefs.getBoolean(mContext,
- Prefs.Key.HAS_SWIPED_UP_FOR_RECENTS, false);
- if (!mTaskListenerRegistered && !alreadyLearnedSwipeUpForRecents) {
+ boolean alreadySeenRecentsOnboarding = Prefs.getBoolean(mContext,
+ Prefs.Key.HAS_SEEN_RECENTS_ONBOARDING, false);
+ if (!mTaskListenerRegistered && !alreadySeenRecentsOnboarding) {
ActivityManagerWrapper.getInstance().registerTaskStackListener(mTaskListener);
mTaskListenerRegistered = true;
}
}
public void onRecentsAnimationStarted() {
- boolean alreadyLearnedSwipeUpForRecents = Prefs.getBoolean(mContext,
- Prefs.Key.HAS_SWIPED_UP_FOR_RECENTS, false);
- if (!alreadyLearnedSwipeUpForRecents) {
- Prefs.putBoolean(mContext, Prefs.Key.HAS_SWIPED_UP_FOR_RECENTS, true);
+ boolean alreadySeenRecentsOnboarding = Prefs.getBoolean(mContext,
+ Prefs.Key.HAS_SEEN_RECENTS_ONBOARDING, false);
+ if (!alreadySeenRecentsOnboarding) {
+ Prefs.putBoolean(mContext, Prefs.Key.HAS_SEEN_RECENTS_ONBOARDING, true);
onDisconnectedFromLauncher();
}
}
@@ -173,6 +176,12 @@ public class SwipeUpOnboarding {
}
public void show() {
+ CharSequence onboardingText = mOverviewProxyService.getOnboardingText();
+ if (TextUtils.isEmpty(onboardingText)) {
+ Log.w(TAG, "Unable to get onboarding text");
+ return;
+ }
+ mTextView.setText(onboardingText);
// Only show in portrait.
int orientation = mContext.getResources().getConfiguration().orientation;
if (!mLayoutAttachedToWindow && orientation == Configuration.ORIENTATION_PORTRAIT) {
@@ -239,7 +248,7 @@ public class SwipeUpOnboarding {
flags,
PixelFormat.TRANSLUCENT);
lp.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS;
- lp.setTitle("SwipeUpOnboarding");
+ lp.setTitle("RecentsOnboarding");
lp.gravity = Gravity.BOTTOM;
return lp;
}
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 c504ed8643d3..ad5144e941ad 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
@@ -50,14 +50,13 @@ import com.android.settingslib.Utils;
import com.android.systemui.Dependency;
import com.android.systemui.DockedStackExistsListener;
import com.android.systemui.OverviewProxyService;
-import com.android.systemui.OverviewProxyService.OverviewProxyListener;
import com.android.systemui.R;
import com.android.systemui.RecentsComponent;
import com.android.systemui.plugins.PluginListener;
import com.android.systemui.plugins.PluginManager;
import com.android.systemui.plugins.statusbar.phone.NavGesture;
import com.android.systemui.plugins.statusbar.phone.NavGesture.GestureHelper;
-import com.android.systemui.recents.SwipeUpOnboarding;
+import com.android.systemui.recents.RecentsOnboarding;
import com.android.systemui.stackdivider.Divider;
import com.android.systemui.statusbar.policy.DeadZone;
import com.android.systemui.statusbar.policy.KeyButtonDrawable;
@@ -126,7 +125,7 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
private NavigationBarInflaterView mNavigationInflaterView;
private RecentsComponent mRecentsComponent;
private Divider mDivider;
- private SwipeUpOnboarding mSwipeUpOnboarding;
+ private RecentsOnboarding mRecentsOnboarding;
private NotificationPanelView mPanelView;
private class NavTransitionListener implements TransitionListener {
@@ -236,7 +235,7 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
new ButtonDispatcher(R.id.rotate_suggestion));
mOverviewProxyService = Dependency.get(OverviewProxyService.class);
- mSwipeUpOnboarding = new SwipeUpOnboarding(context);
+ mRecentsOnboarding = new RecentsOnboarding(context, mOverviewProxyService);
}
public BarTransitions getBarTransitions() {
@@ -265,8 +264,8 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
public void setRecentsAnimationStarted(boolean started) {
mRecentsAnimationStarted = started;
- if (mSwipeUpOnboarding != null) {
- mSwipeUpOnboarding.onRecentsAnimationStarted();
+ if (mRecentsOnboarding != null) {
+ mRecentsOnboarding.onRecentsAnimationStarted();
}
}
@@ -675,8 +674,8 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
if (mGestureHelper != null) {
mGestureHelper.onDarkIntensityChange(intensity);
}
- if (mSwipeUpOnboarding != null) {
- mSwipeUpOnboarding.setContentDarkIntensity(intensity);
+ if (mRecentsOnboarding != null) {
+ mRecentsOnboarding.setContentDarkIntensity(intensity);
}
}
@@ -794,7 +793,7 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
updateTaskSwitchHelper();
updateIcons(getContext(), mConfiguration, newConfig);
updateRecentsIcon();
- mSwipeUpOnboarding.onConfigurationChanged(newConfig);
+ mRecentsOnboarding.onConfigurationChanged(newConfig);
if (uiCarModeChanged || mConfiguration.densityDpi != newConfig.densityDpi
|| mConfiguration.getLayoutDirection() != newConfig.getLayoutDirection()) {
// If car mode or density changes, we need to reset the icons.
@@ -898,9 +897,9 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
private void setUpSwipeUpOnboarding(boolean connectedToOverviewProxy) {
if (connectedToOverviewProxy) {
- mSwipeUpOnboarding.onConnectedToLauncher();
+ mRecentsOnboarding.onConnectedToLauncher();
} else {
- mSwipeUpOnboarding.onDisconnectedFromLauncher();
+ mRecentsOnboarding.onDisconnectedFromLauncher();
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
index 59c44ed6635f..2b16e740d0ba 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
@@ -30,6 +30,7 @@ import android.os.Handler;
import android.os.Trace;
import android.util.Log;
import android.util.MathUtils;
+import android.view.Choreographer;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
@@ -111,7 +112,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
protected static final float SCRIM_IN_FRONT_ALPHA_LOCKED = GRADIENT_SCRIM_ALPHA_BUSY;
static final int TAG_KEY_ANIM = R.id.scrim;
- static final int TAG_KEY_ANIM_BLANK = R.id.scrim_blanking;
private static final int TAG_KEY_ANIM_TARGET = R.id.scrim_target;
private static final int TAG_START_ALPHA = R.id.scrim_alpha_start;
private static final int TAG_END_ALPHA = R.id.scrim_alpha_end;
@@ -166,6 +166,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
private boolean mScreenBlankingCallbackCalled;
private Callback mCallback;
private boolean mWallpaperSupportsAmbientMode;
+ private Choreographer.FrameCallback mPendingFrameCallback;
private final WakeLock mWakeLock;
private boolean mWakeLockHeld;
@@ -248,6 +249,11 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
mCurrentInFrontAlpha = state.getFrontAlpha();
mCurrentBehindAlpha = state.getBehindAlpha();
+ if (mPendingFrameCallback != null) {
+ Choreographer.getInstance().removeFrameCallback(mPendingFrameCallback);
+ mPendingFrameCallback = null;
+ }
+
// Showing/hiding the keyguard means that scrim colors have to be switched, not necessary
// to do the same when you're just showing the brightness mirror.
mNeedsDrawableColorUpdate = state != ScrimState.BRIGHTNESS_MIRROR;
@@ -692,11 +698,12 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
}
}
- final boolean blankingInProgress = mScrimInFront.getTag(TAG_KEY_ANIM_BLANK) != null;
- if (mBlankScreen || blankingInProgress) {
- if (!blankingInProgress) {
- blankDisplay();
- }
+ if (mPendingFrameCallback != null) {
+ // Display is off and we're waiting.
+ return;
+ } else if (mBlankScreen) {
+ // Need to blank the display before continuing.
+ blankDisplay();
return;
} else if (!mScreenBlankingCallbackCalled) {
// Not blanking the screen. Letting the callback know that we're ready
@@ -750,45 +757,33 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
}
private void blankDisplay() {
- final float initialAlpha = mScrimInFront.getViewAlpha();
- final int initialTint = mScrimInFront.getTint();
- ValueAnimator anim = ValueAnimator.ofFloat(0, 1);
- anim.addUpdateListener(animation -> {
- final float amount = (float) animation.getAnimatedValue();
- float animAlpha = MathUtils.lerp(initialAlpha, 1, amount);
- int animTint = ColorUtils.blendARGB(initialTint, Color.BLACK, amount);
- updateScrimColor(mScrimInFront, animAlpha, animTint);
- dispatchScrimsVisible();
- });
- anim.setInterpolator(getInterpolator());
- anim.setDuration(mDozeParameters.getPulseInDuration());
- anim.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- if (mCallback != null) {
- mCallback.onDisplayBlanked();
- mScreenBlankingCallbackCalled = true;
- }
- Runnable blankingCallback = () -> {
- mScrimInFront.setTag(TAG_KEY_ANIM_BLANK, null);
- mBlankScreen = false;
- // Try again.
- updateScrims();
- };
-
- // Setting power states can happen after we push out the frame. Make sure we
- // stay fully opaque until the power state request reaches the lower levels.
- getHandler().postDelayed(blankingCallback, 100);
+ updateScrimColor(mScrimInFront, 1, Color.BLACK);
+ // Notify callback that the screen is completely black and we're
+ // ready to change the display power mode
+ mPendingFrameCallback = frameTimeNanos -> {
+ if (mCallback != null) {
+ mCallback.onDisplayBlanked();
+ mScreenBlankingCallbackCalled = true;
}
- });
- anim.start();
- mScrimInFront.setTag(TAG_KEY_ANIM_BLANK, anim);
- // Finish animation if we're already at its final state
- if (initialAlpha == 1 && mScrimInFront.getTint() == Color.BLACK) {
- anim.end();
- }
+ Runnable blankingCallback = () -> {
+ mPendingFrameCallback = null;
+ mBlankScreen = false;
+ // Try again.
+ updateScrims();
+ };
+
+ // Setting power states can happen after we push out the frame. Make sure we
+ // stay fully opaque until the power state request reaches the lower levels.
+ getHandler().postDelayed(blankingCallback, 100);
+ };
+ doOnTheNextFrame(mPendingFrameCallback);
+ }
+
+ @VisibleForTesting
+ protected void doOnTheNextFrame(Choreographer.FrameCallback callback) {
+ Choreographer.getInstance().postFrameCallback(callback);
}
@VisibleForTesting
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java
index 314d6aa2bf57..381e4af31853 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java
@@ -48,7 +48,6 @@ public enum ScrimState {
// set our scrim to black in this frame to avoid flickering and
// fade it out afterwards.
mBlankScreen = true;
- updateScrimColor(mScrimInFront, 1, Color.BLACK);
}
} else {
mAnimationDuration = ScrimController.ANIMATION_DURATION;
@@ -86,9 +85,6 @@ public enum ScrimState {
AOD(3) {
@Override
public void prepare(ScrimState previousState) {
- if (previousState == ScrimState.PULSING && !mCanControlScreenOff) {
- updateScrimColor(mScrimInFront, 1, Color.BLACK);
- }
final boolean alwaysOnEnabled = mDozeParameters.getAlwaysOn();
final boolean wasPulsing = previousState == ScrimState.PULSING;
mBlankScreen = wasPulsing && !mCanControlScreenOff;
@@ -115,9 +111,6 @@ public enum ScrimState {
&& !mKeyguardUpdateMonitor.hasLockscreenWallpaper() ? 0f : 1f;
mCurrentBehindTint = Color.BLACK;
mBlankScreen = mDisplayRequiresBlanking;
- if (mDisplayRequiresBlanking) {
- updateScrimColor(mScrimInFront, 1, Color.BLACK);
- }
}
},
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogComponent.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogComponent.java
index efa8386802e2..0203c43d3683 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogComponent.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogComponent.java
@@ -27,16 +27,15 @@ import android.os.Handler;
import android.view.WindowManager.LayoutParams;
import com.android.settingslib.applications.InterestingConfigChanges;
-import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.Dependency;
import com.android.systemui.SystemUI;
import com.android.systemui.keyguard.KeyguardViewMediator;
+import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.PluginDependencyProvider;
import com.android.systemui.plugins.VolumeDialog;
import com.android.systemui.plugins.VolumeDialogController;
import com.android.systemui.qs.tiles.DndTile;
import com.android.systemui.statusbar.policy.ExtensionController;
-import com.android.systemui.statusbar.policy.ExtensionController.Extension;
import com.android.systemui.tuner.TunerService;
import java.io.FileDescriptor;
@@ -53,8 +52,8 @@ public class VolumeDialogComponent implements VolumeComponent, TunerService.Tuna
public static final String VOLUME_SILENT_DO_NOT_DISTURB = "sysui_do_not_disturb";
public static final boolean DEFAULT_VOLUME_DOWN_TO_ENTER_SILENT = false;
- public static final boolean DEFAULT_VOLUME_UP_TO_EXIT_SILENT = true;
- public static final boolean DEFAULT_DO_NOT_DISTURB_WHEN_SILENT = true;
+ public static final boolean DEFAULT_VOLUME_UP_TO_EXIT_SILENT = false;
+ public static final boolean DEFAULT_DO_NOT_DISTURB_WHEN_SILENT = false;
private final SystemUI mSysui;
private final Context mContext;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java
index 6d2691c899f2..43e16dbeaeed 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java
@@ -38,6 +38,7 @@ import android.os.Looper;
import android.support.test.filters.SmallTest;
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper;
+import android.view.Choreographer;
import android.view.View;
import com.android.keyguard.KeyguardUpdateMonitor;
@@ -374,7 +375,6 @@ public class ScrimControllerTest extends SysuiTestCase {
onPreDraw();
// Force finish screen blanking.
- endAnimation(mScrimInFront, TAG_KEY_ANIM_BLANK);
mHandler.dispatchQueuedMessages();
// Force finish all animations.
endAnimation(mScrimBehind, TAG_KEY_ANIM);
@@ -401,6 +401,15 @@ public class ScrimControllerTest extends SysuiTestCase {
protected WakeLock createWakeLock() {
return mWakeLock;
}
+
+ /**
+ * Do not wait for a frame since we're in a test environment.
+ * @param callback What to execute.
+ */
+ @Override
+ protected void doOnTheNextFrame(Choreographer.FrameCallback callback) {
+ callback.doFrame(0);
+ }
}
}
diff --git a/proto/Android.bp b/proto/Android.bp
index 95f453c3e523..f3811bdd7d81 100644
--- a/proto/Android.bp
+++ b/proto/Android.bp
@@ -6,6 +6,8 @@ java_library_static {
},
srcs: ["src/**/*.proto"],
no_framework_libs: true,
+ // Pin java_version until jarjar is certified to support later versions. http://b/72703434
+ java_version: "1.8",
target: {
android: {
jarjar_rules: "jarjar-rules.txt",
diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java
index 6743484b91c4..6747be340d46 100644
--- a/services/core/java/com/android/server/TelephonyRegistry.java
+++ b/services/core/java/com/android/server/TelephonyRegistry.java
@@ -35,7 +35,6 @@ import android.os.UserHandle;
import android.telephony.CellInfo;
import android.telephony.CellLocation;
import android.telephony.DisconnectCause;
-import android.telephony.LocationAccessPolicy;
import android.telephony.PhoneStateListener;
import android.telephony.PreciseCallState;
import android.telephony.PreciseDataConnectionState;
@@ -94,8 +93,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
IPhoneStateListener callback;
IOnSubscriptionsChangedListener onSubscriptionsChangedListenerCallback;
- int callerUid;
- int callerPid;
+ int callerUserId;
int events;
@@ -119,7 +117,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
+ " callback=" + callback
+ " onSubscriptionsChangedListenererCallback="
+ onSubscriptionsChangedListenerCallback
- + " callerUid=" + callerUid + " subId=" + subId + " phoneId=" + phoneId
+ + " callerUserId=" + callerUserId + " subId=" + subId + " phoneId=" + phoneId
+ " events=" + Integer.toHexString(events)
+ " canReadPhoneState=" + canReadPhoneState + "}";
}
@@ -358,8 +356,6 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
public void addOnSubscriptionsChangedListener(String callingPackage,
IOnSubscriptionsChangedListener callback) {
int callerUserId = UserHandle.getCallingUserId();
- mContext.getSystemService(AppOpsManager.class)
- .checkPackage(Binder.getCallingUid(), callingPackage);
if (VDBG) {
log("listen oscl: E pkg=" + callingPackage + " myUserId=" + UserHandle.myUserId()
+ " callerUserId=" + callerUserId + " callback=" + callback
@@ -403,8 +399,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
r.onSubscriptionsChangedListenerCallback = callback;
r.callingPackage = callingPackage;
- r.callerUid = Binder.getCallingUid();
- r.callerPid = Binder.getCallingPid();
+ r.callerUserId = callerUserId;
r.events = 0;
r.canReadPhoneState = true; // permission has been enforced above
if (DBG) {
@@ -475,8 +470,6 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
private void listen(String callingPackage, IPhoneStateListener callback, int events,
boolean notifyNow, int subId) {
int callerUserId = UserHandle.getCallingUserId();
- mContext.getSystemService(AppOpsManager.class)
- .checkPackage(Binder.getCallingUid(), callingPackage);
if (VDBG) {
log("listen: E pkg=" + callingPackage + " events=0x" + Integer.toHexString(events)
+ " notifyNow=" + notifyNow + " subId=" + subId + " myUserId="
@@ -521,8 +514,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
r.callback = callback;
r.callingPackage = callingPackage;
- r.callerUid = Binder.getCallingUid();
- r.callerPid = Binder.getCallingPid();
+ r.callerUserId = callerUserId;
boolean isPhoneStateEvent = (events & (CHECK_PHONE_STATE_PERMISSION_MASK
| ENFORCE_PHONE_STATE_PERMISSION_MASK)) != 0;
r.canReadPhoneState = isPhoneStateEvent && canReadPhoneState(callingPackage);
@@ -580,10 +572,8 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
try {
if (DBG_LOC) log("listen: mCellLocation = "
+ mCellLocation[phoneId]);
- if (checkLocationAccess(r)) {
- r.callback.onCellLocationChanged(
- new Bundle(mCellLocation[phoneId]));
- }
+ r.callback.onCellLocationChanged(
+ new Bundle(mCellLocation[phoneId]));
} catch (RemoteException ex) {
remove(r.binder);
}
@@ -629,9 +619,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
try {
if (DBG_LOC) log("listen: mCellInfo[" + phoneId + "] = "
+ mCellInfo.get(phoneId));
- if (checkLocationAccess(r)) {
- r.callback.onCellInfoChanged(mCellInfo.get(phoneId));
- }
+ r.callback.onCellInfoChanged(mCellInfo.get(phoneId));
} catch (RemoteException ex) {
remove(r.binder);
}
@@ -991,8 +979,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
mCellInfo.set(phoneId, cellInfo);
for (Record r : mRecords) {
if (validateEventsAndUserLocked(r, PhoneStateListener.LISTEN_CELL_INFO) &&
- idMatch(r.subId, subId, phoneId) &&
- checkLocationAccess(r)) {
+ idMatch(r.subId, subId, phoneId)) {
try {
if (DBG_LOC) {
log("notifyCellInfo: mCellInfo=" + cellInfo + " r=" + r);
@@ -1275,8 +1262,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
mCellLocation[phoneId] = cellLocation;
for (Record r : mRecords) {
if (validateEventsAndUserLocked(r, PhoneStateListener.LISTEN_CELL_LOCATION) &&
- idMatch(r.subId, subId, phoneId) &&
- checkLocationAccess(r)) {
+ idMatch(r.subId, subId, phoneId)) {
try {
if (DBG_LOC) {
log("notifyCellLocation: cellLocation=" + cellLocation
@@ -1720,11 +1706,10 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
boolean valid = false;
try {
foregroundUser = ActivityManager.getCurrentUser();
- valid = UserHandle.getUserId(r.callerUid) == foregroundUser
- && r.matchPhoneStateListenerEvent(events);
+ valid = r.callerUserId == foregroundUser && r.matchPhoneStateListenerEvent(events);
if (DBG | DBG_LOC) {
log("validateEventsAndUserLocked: valid=" + valid
- + " r.callerUid=" + r.callerUid + " foregroundUser=" + foregroundUser
+ + " r.callerUserId=" + r.callerUserId + " foregroundUser=" + foregroundUser
+ " r.events=" + r.events + " events=" + events);
}
} finally {
@@ -1756,16 +1741,6 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
}
}
- private boolean checkLocationAccess(Record r) {
- long token = Binder.clearCallingIdentity();
- try {
- return LocationAccessPolicy.canAccessCellLocation(mContext,
- r.callingPackage, r.callerUid, r.callerPid);
- } finally {
- Binder.restoreCallingIdentity(token);
- }
- }
-
private void checkPossibleMissNotify(Record r, int phoneId) {
int events = r.events;
@@ -1813,9 +1788,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
log("checkPossibleMissNotify: onCellInfoChanged[" + phoneId + "] = "
+ mCellInfo.get(phoneId));
}
- if (checkLocationAccess(r)) {
- r.callback.onCellInfoChanged(mCellInfo.get(phoneId));
- }
+ r.callback.onCellInfoChanged(mCellInfo.get(phoneId));
} catch (RemoteException ex) {
mRemoveList.add(r.binder);
}
@@ -1863,9 +1836,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
try {
if (DBG_LOC) log("checkPossibleMissNotify: onCellLocationChanged mCellLocation = "
+ mCellLocation[phoneId]);
- if (checkLocationAccess(r)) {
- r.callback.onCellLocationChanged(new Bundle(mCellLocation[phoneId]));
- }
+ r.callback.onCellLocationChanged(new Bundle(mCellLocation[phoneId]));
} catch (RemoteException ex) {
mRemoveList.add(r.binder);
}
diff --git a/services/core/java/com/android/server/am/GlobalSettingsToPropertiesMapper.java b/services/core/java/com/android/server/am/GlobalSettingsToPropertiesMapper.java
index fe6597847320..9033b55f0b4f 100644
--- a/services/core/java/com/android/server/am/GlobalSettingsToPropertiesMapper.java
+++ b/services/core/java/com/android/server/am/GlobalSettingsToPropertiesMapper.java
@@ -41,7 +41,6 @@ class GlobalSettingsToPropertiesMapper {
// {Settings.Global.SETTING_NAME, "system_property_name"},
{Settings.Global.SYS_VDSO, "sys.vdso"},
{Settings.Global.FPS_DEVISOR, ThreadedRenderer.DEBUG_FPS_DIVISOR},
- {Settings.Global.UID_CPUPOWER, "uid.cpupower"},
{Settings.Global.DISPLAY_PANEL_LPM, "sys.display_panel_lpm"},
};
diff --git a/services/core/java/com/android/server/am/UserController.java b/services/core/java/com/android/server/am/UserController.java
index 7b0c714b0b4e..d54e2640ceed 100644
--- a/services/core/java/com/android/server/am/UserController.java
+++ b/services/core/java/com/android/server/am/UserController.java
@@ -743,7 +743,7 @@ class UserController implements Handler.Callback {
mInjector.stackSupervisorRemoveUser(userId);
// Remove the user if it is ephemeral.
if (getUserInfo(userId).isEphemeral()) {
- mInjector.getUserManager().removeUser(userId);
+ mInjector.getUserManager().removeUserEvenWhenDisallowed(userId);
}
// Evict the user's credential encryption key.
try {
diff --git a/services/core/java/com/android/server/car/CarServiceHelperService.java b/services/core/java/com/android/server/car/CarServiceHelperService.java
deleted file mode 100644
index 9392a6a8fcd9..000000000000
--- a/services/core/java/com/android/server/car/CarServiceHelperService.java
+++ /dev/null
@@ -1,91 +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.
- */
-
-package com.android.server.car;
-
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.ServiceConnection;
-import android.os.Binder;
-import android.os.IBinder;
-import android.os.Parcel;
-import android.os.RemoteException;
-import android.os.UserHandle;
-import android.util.Slog;
-
-import com.android.internal.car.ICarServiceHelper;
-import com.android.server.SystemService;
-
-/**
- * System service side companion service for CarService.
- * Starts car service and provide necessary API for CarService. Only for car product.
- */
-public class CarServiceHelperService extends SystemService {
- private static final String TAG = "CarServiceHelper";
- private static final String CAR_SERVICE_INTERFACE = "android.car.ICar";
- private final ICarServiceHelperImpl mHelper = new ICarServiceHelperImpl();
- private IBinder mCarService;
- private final ServiceConnection mCarServiceConnection = new ServiceConnection() {
-
- @Override
- public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
- Slog.i(TAG, "**CarService connected**");
- mCarService = iBinder;
- // Cannot depend on ICar which is defined in CarService, so handle binder call directly
- // instead.
- // void setCarServiceHelper(in IBinder helper)
- Parcel data = Parcel.obtain();
- data.writeInterfaceToken(CAR_SERVICE_INTERFACE);
- data.writeStrongBinder(mHelper.asBinder());
- try {
- mCarService.transact(IBinder.FIRST_CALL_TRANSACTION, // setCarServiceHelper
- data, null, Binder.FLAG_ONEWAY);
- } catch (RemoteException e) {
- Slog.w(TAG, "RemoteException from car service", e);
- handleCarServiceCrash();
- }
- }
-
- @Override
- public void onServiceDisconnected(ComponentName componentName) {
- handleCarServiceCrash();
- }
- };
-
- public CarServiceHelperService(Context context) {
- super(context);
- }
-
- @Override
- public void onStart() {
- Intent intent = new Intent();
- intent.setPackage("com.android.car");
- intent.setAction(CAR_SERVICE_INTERFACE);
- if (!getContext().bindServiceAsUser(intent, mCarServiceConnection, Context.BIND_AUTO_CREATE,
- UserHandle.SYSTEM)) {
- Slog.wtf(TAG, "cannot start car service");
- }
- }
-
- private void handleCarServiceCrash() {
- //TODO define recovery bahavior
- }
-
- private class ICarServiceHelperImpl extends ICarServiceHelper.Stub {
- //TODO
- }
-}
diff --git a/services/core/java/com/android/server/locksettings/recoverablekeystore/RecoverableKeyStoreManager.java b/services/core/java/com/android/server/locksettings/recoverablekeystore/RecoverableKeyStoreManager.java
index fda6cdf33e0c..33e767fe1a8f 100644
--- a/services/core/java/com/android/server/locksettings/recoverablekeystore/RecoverableKeyStoreManager.java
+++ b/services/core/java/com/android/server/locksettings/recoverablekeystore/RecoverableKeyStoreManager.java
@@ -519,11 +519,11 @@ public class RecoverableKeyStoreManager {
byte[] locallyEncryptedKey;
try {
// TODO: Remove the extraneous logging here
- Log.e(TAG, constructLoggingMessage("sessionEntry.getKeyClaimant()",
+ Log.d(TAG, constructLoggingMessage("sessionEntry.getKeyClaimant()",
sessionEntry.getKeyClaimant()));
- Log.e(TAG, constructLoggingMessage("sessionEntry.getVaultParams()",
+ Log.d(TAG, constructLoggingMessage("sessionEntry.getVaultParams()",
sessionEntry.getVaultParams()));
- Log.e(TAG, constructLoggingMessage("encryptedClaimResponse", encryptedClaimResponse));
+ Log.d(TAG, constructLoggingMessage("encryptedClaimResponse", encryptedClaimResponse));
locallyEncryptedKey = KeySyncUtils.decryptRecoveryClaimResponse(
sessionEntry.getKeyClaimant(),
sessionEntry.getVaultParams(),
@@ -543,9 +543,9 @@ public class RecoverableKeyStoreManager {
try {
// TODO: Remove the extraneous logging here
- Log.e(TAG, constructLoggingMessage("sessionEntry.getLskfHash()",
+ Log.d(TAG, constructLoggingMessage("sessionEntry.getLskfHash()",
sessionEntry.getLskfHash()));
- Log.e(TAG, constructLoggingMessage("locallyEncryptedKey", locallyEncryptedKey));
+ Log.d(TAG, constructLoggingMessage("locallyEncryptedKey", locallyEncryptedKey));
return KeySyncUtils.decryptRecoveryKey(sessionEntry.getLskfHash(), locallyEncryptedKey);
} catch (InvalidKeyException e) {
Log.e(TAG, "Got InvalidKeyException during decrypting recovery key", e);
@@ -585,8 +585,8 @@ public class RecoverableKeyStoreManager {
try {
// TODO: Remove the extraneous logging here
- Log.e(TAG, constructLoggingMessage("recoveryKey", recoveryKey));
- Log.e(TAG, constructLoggingMessage("encryptedKeyMaterial", encryptedKeyMaterial));
+ Log.d(TAG, constructLoggingMessage("recoveryKey", recoveryKey));
+ Log.d(TAG, constructLoggingMessage("encryptedKeyMaterial", encryptedKeyMaterial));
byte[] keyMaterial =
KeySyncUtils.decryptApplicationKey(recoveryKey, encryptedKeyMaterial);
keyMaterialByAlias.put(alias, keyMaterial);
@@ -600,13 +600,16 @@ public class RecoverableKeyStoreManager {
throw new ServiceSpecificException(ERROR_DECRYPTION_FAILED,
"Failed to recover key with alias '" + alias + "': " + e.getMessage());
} catch (AEADBadTagException e) {
- // TODO: Remove the extraneous logging here
Log.e(TAG, "Got AEADBadTagException during decrypting application key with alias: "
+ alias, e);
- throw new ServiceSpecificException(ERROR_DECRYPTION_FAILED,
- "Failed to recover key with alias '" + alias + "': " + e.getMessage());
+ // Ignore the exception to continue to recover the other application keys.
}
}
+ if (keyMaterialByAlias.isEmpty()) {
+ Log.e(TAG, "Failed to recover any of the application keys.");
+ throw new ServiceSpecificException(ERROR_DECRYPTION_FAILED,
+ "Failed to recover any of the application keys.");
+ }
return keyMaterialByAlias;
}
diff --git a/services/core/java/com/android/server/net/watchlist/WatchlistLoggingHandler.java b/services/core/java/com/android/server/net/watchlist/WatchlistLoggingHandler.java
index c4de4ac1b7dc..81fe641a6409 100644
--- a/services/core/java/com/android/server/net/watchlist/WatchlistLoggingHandler.java
+++ b/services/core/java/com/android/server/net/watchlist/WatchlistLoggingHandler.java
@@ -128,7 +128,7 @@ class WatchlistLoggingHandler extends Handler {
Slog.e(TAG, "Couldn't find package: " + packageNames);
return false;
}
- ai = mPm.getApplicationInfo(packageNames[0],0);
+ ai = mPm.getApplicationInfo(packageNames[0], 0);
} catch (NameNotFoundException e) {
// Should not happen.
return false;
@@ -136,7 +136,7 @@ class WatchlistLoggingHandler extends Handler {
return (ai.flags & ApplicationInfo.FLAG_TEST_ONLY) != 0;
}
- /**
+ /**
* Report network watchlist records if we collected enough data.
*/
public void reportWatchlistIfNecessary() {
@@ -180,6 +180,10 @@ class WatchlistLoggingHandler extends Handler {
return true;
}
final byte[] digest = getDigestFromUid(uid);
+ if (digest == null) {
+ Slog.e(TAG, "Cannot get digest from uid: " + uid);
+ return false;
+ }
final boolean result = mDbHelper.insertNewRecord(digest, cncHost, timestamp);
tryAggregateRecords();
return result;
@@ -242,6 +246,11 @@ class WatchlistLoggingHandler extends Handler {
final int size = apps.size();
for (int i = 0; i < size; i++) {
byte[] digest = getDigestFromUid(apps.get(i).uid);
+ if (digest == null) {
+ Slog.e(TAG, "Cannot get digest from uid: " + apps.get(i).uid
+ + ",pkg: " + apps.get(i).packageName);
+ continue;
+ }
result.add(HexDump.toHexString(digest));
}
// Step 2: Add all digests from records
diff --git a/services/core/java/com/android/server/stats/StatsCompanionService.java b/services/core/java/com/android/server/stats/StatsCompanionService.java
index c280739f2e1a..a87ae1e4d4a0 100644
--- a/services/core/java/com/android/server/stats/StatsCompanionService.java
+++ b/services/core/java/com/android/server/stats/StatsCompanionService.java
@@ -284,7 +284,7 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
}
}
- private final static class AnomalyAlarmReceiver extends BroadcastReceiver {
+ public final static class AnomalyAlarmReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Slog.i(TAG, "StatsCompanionService believes an anomaly has occurred.");
@@ -304,7 +304,7 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
}
}
- private final static class PullingAlarmReceiver extends BroadcastReceiver {
+ public final static class PullingAlarmReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (DEBUG)
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 3210f1a2e8b9..c3614346bbdc 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -65,7 +65,6 @@ import com.android.server.am.ActivityManagerService;
import com.android.server.audio.AudioService;
import com.android.server.broadcastradio.BroadcastRadioService;
import com.android.server.camera.CameraServiceProxy;
-import com.android.server.car.CarServiceHelperService;
import com.android.server.clipboard.ClipboardService;
import com.android.server.connectivity.IpConnectivityMetrics;
import com.android.server.coverage.CoverageService;
@@ -220,6 +219,8 @@ public final class SystemServer {
"com.google.android.things.services.IoTSystemService";
private static final String SLICE_MANAGER_SERVICE_CLASS =
"com.android.server.slice.SliceManagerService$Lifecycle";
+ private static final String CAR_SERVICE_HELPER_SERVICE_CLASS =
+ "com.android.internal.car.CarServiceHelperService";
private static final String PERSISTENT_DATA_BLOCK_PROP = "ro.frp.pst";
@@ -1750,7 +1751,7 @@ public final class SystemServer {
if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE)) {
traceBeginAndSlog("StartCarServiceHelperService");
- mSystemServiceManager.startService(CarServiceHelperService.class);
+ mSystemServiceManager.startService(CAR_SERVICE_HELPER_SERVICE_CLASS);
traceEnd();
}
diff --git a/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/RecoverableKeyStoreManagerTest.java b/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/RecoverableKeyStoreManagerTest.java
index 473a813c3838..2343deec020b 100644
--- a/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/RecoverableKeyStoreManagerTest.java
+++ b/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/RecoverableKeyStoreManagerTest.java
@@ -125,6 +125,7 @@ public class RecoverableKeyStoreManagerTest {
private static final byte[] RECOVERY_RESPONSE_HEADER =
"V1 reencrypted_recovery_key".getBytes(StandardCharsets.UTF_8);
private static final String TEST_ALIAS = "nick";
+ private static final String TEST_ALIAS2 = "bob";
private static final int RECOVERABLE_KEY_SIZE_BYTES = 32;
private static final int GENERATION_ID = 1;
private static final byte[] NONCE = getUtf8Bytes("nonce");
@@ -424,7 +425,7 @@ public class RecoverableKeyStoreManagerTest {
}
@Test
- public void recoverKeys_throwsIfFailedToDecryptAnApplicationKey() throws Exception {
+ public void recoverKeys_throwsIfFailedToDecryptAllApplicationKeys() throws Exception {
mRecoverableKeyStoreManager.startRecoverySession(
TEST_SESSION_ID,
TEST_PUBLIC_KEY,
@@ -442,7 +443,7 @@ public class RecoverableKeyStoreManagerTest {
keyClaimant, TEST_SECRET, TEST_VAULT_PARAMS, recoveryKey);
WrappedApplicationKey badApplicationKey = new WrappedApplicationKey(
TEST_ALIAS,
- randomBytes(32));
+ encryptedApplicationKey(randomRecoveryKey(), randomBytes(32)));
try {
mRecoverableKeyStoreManager.recoverKeys(
@@ -451,7 +452,7 @@ public class RecoverableKeyStoreManagerTest {
/*applicationKeys=*/ ImmutableList.of(badApplicationKey));
fail("should have thrown");
} catch (ServiceSpecificException e) {
- assertThat(e.getMessage()).startsWith("Failed to recover key with alias 'nick'");
+ assertThat(e.getMessage()).startsWith("Failed to recover any of the application keys");
}
}
@@ -487,6 +488,44 @@ public class RecoverableKeyStoreManagerTest {
}
@Test
+ public void recoverKeys_worksOnOtherApplicationKeysIfOneDecryptionFails() throws Exception {
+ mRecoverableKeyStoreManager.startRecoverySession(
+ TEST_SESSION_ID,
+ TEST_PUBLIC_KEY,
+ TEST_VAULT_PARAMS,
+ TEST_VAULT_CHALLENGE,
+ ImmutableList.of(new KeyChainProtectionParams(
+ TYPE_LOCKSCREEN,
+ UI_FORMAT_PASSWORD,
+ KeyDerivationParams.createSha256Params(TEST_SALT),
+ TEST_SECRET)));
+ byte[] keyClaimant = mRecoverySessionStorage.get(Binder.getCallingUid(), TEST_SESSION_ID)
+ .getKeyClaimant();
+ SecretKey recoveryKey = randomRecoveryKey();
+ byte[] encryptedClaimResponse = encryptClaimResponse(
+ keyClaimant, TEST_SECRET, TEST_VAULT_PARAMS, recoveryKey);
+
+ byte[] applicationKeyBytes1 = randomBytes(32);
+ byte[] applicationKeyBytes2 = randomBytes(32);
+
+ WrappedApplicationKey applicationKey1 = new WrappedApplicationKey(
+ TEST_ALIAS,
+ // Use a different recovery key here, so the decryption will fail
+ encryptedApplicationKey(randomRecoveryKey(), applicationKeyBytes1));
+ WrappedApplicationKey applicationKey2 = new WrappedApplicationKey(
+ TEST_ALIAS2,
+ encryptedApplicationKey(recoveryKey, applicationKeyBytes2));
+
+ Map<String, byte[]> recoveredKeys = mRecoverableKeyStoreManager.recoverKeys(
+ TEST_SESSION_ID,
+ encryptedClaimResponse,
+ ImmutableList.of(applicationKey1, applicationKey2));
+
+ assertThat(recoveredKeys).hasSize(1);
+ assertThat(recoveredKeys.get(TEST_ALIAS2)).isEqualTo(applicationKeyBytes2);
+ }
+
+ @Test
public void setSnapshotCreatedPendingIntent() throws Exception {
int uid = Binder.getCallingUid();
PendingIntent intent = PendingIntent.getBroadcast(
diff --git a/telephony/java/android/telephony/LocationAccessPolicy.java b/telephony/java/android/telephony/LocationAccessPolicy.java
deleted file mode 100644
index b362df9ff677..000000000000
--- a/telephony/java/android/telephony/LocationAccessPolicy.java
+++ /dev/null
@@ -1,160 +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
- */
-
-package android.telephony;
-
-import android.Manifest;
-import android.annotation.NonNull;
-import android.annotation.UserIdInt;
-import android.app.ActivityManager;
-import android.app.AppOpsManager;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.pm.PackageManager;
-import android.content.pm.UserInfo;
-import android.location.LocationManager;
-import android.os.Binder;
-import android.os.Build;
-import android.os.Process;
-import android.os.Trace;
-import android.os.UserHandle;
-import android.os.UserManager;
-import android.provider.Settings;
-import android.util.SparseBooleanArray;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Helper for performing location access checks.
- * @hide
- */
-public final class LocationAccessPolicy {
- /**
- * API to determine if the caller has permissions to get cell location.
- *
- * @param pkgName Package name of the application requesting access
- * @param uid The uid of the package
- * @param pid The pid of the package
- * @return boolean true or false if permissions is granted
- */
- public static boolean canAccessCellLocation(@NonNull Context context, @NonNull String pkgName,
- int uid, int pid) throws SecurityException {
- Trace.beginSection("TelephonyLocationCheck");
- try {
- // Always allow the phone process to access location. This avoid breaking legacy code
- // that rely on public-facing APIs to access cell location, and it doesn't create a
- // info leak risk because the cell location is stored in the phone process anyway.
- if (uid == Process.PHONE_UID) {
- return true;
- }
-
- // We always require the location permission and also require the
- // location mode to be on for non-legacy apps. Legacy apps are
- // required to be in the foreground to at least mitigate the case
- // where a legacy app the user is not using tracks their location.
- // Granting ACCESS_FINE_LOCATION to an app automatically grants it
- // ACCESS_COARSE_LOCATION.
-
- if (context.checkPermission(Manifest.permission.ACCESS_COARSE_LOCATION, pid, uid) ==
- PackageManager.PERMISSION_DENIED) {
- return false;
- }
- final int opCode = AppOpsManager.permissionToOpCode(
- Manifest.permission.ACCESS_COARSE_LOCATION);
- if (opCode != AppOpsManager.OP_NONE && context.getSystemService(AppOpsManager.class)
- .noteOpNoThrow(opCode, uid, pkgName) != AppOpsManager.MODE_ALLOWED) {
- return false;
- }
- if (!isLocationModeEnabled(context, UserHandle.getUserId(uid))
- && !isLegacyForeground(context, pkgName, uid)) {
- return false;
- }
- // If the user or profile is current, permission is granted.
- // Otherwise, uid must have INTERACT_ACROSS_USERS_FULL permission.
- return isCurrentProfile(context, uid) || checkInteractAcrossUsersFull(context);
- } finally {
- Trace.endSection();
- }
- }
-
- private static boolean isLocationModeEnabled(@NonNull Context context, @UserIdInt int userId) {
- int locationMode = Settings.Secure.getIntForUser(context.getContentResolver(),
- Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_OFF, userId);
- return locationMode != Settings.Secure.LOCATION_MODE_OFF
- && locationMode != Settings.Secure.LOCATION_MODE_SENSORS_ONLY;
- }
-
- private static boolean isLegacyForeground(@NonNull Context context, @NonNull String pkgName,
- int uid) {
- long token = Binder.clearCallingIdentity();
- try {
- return isLegacyVersion(context, pkgName) && isForegroundApp(context, uid);
- } finally {
- Binder.restoreCallingIdentity(token);
- }
- }
-
- private static boolean isLegacyVersion(@NonNull Context context, @NonNull String pkgName) {
- try {
- if (context.getPackageManager().getApplicationInfo(pkgName, 0)
- .targetSdkVersion <= Build.VERSION_CODES.O) {
- return true;
- }
- } catch (PackageManager.NameNotFoundException e) {
- // In case of exception, assume known app (more strict checking)
- // Note: This case will never happen since checkPackage is
- // called to verify validity before checking app's version.
- }
- return false;
- }
-
- private static boolean isForegroundApp(@NonNull Context context, int uid) {
- final ActivityManager am = context.getSystemService(ActivityManager.class);
- return am.getUidImportance(uid) <= ActivityManager.RunningAppProcessInfo.IMPORTANCE_VISIBLE;
- }
-
- private static boolean checkInteractAcrossUsersFull(@NonNull Context context) {
- return context.checkCallingOrSelfPermission(
- android.Manifest.permission.INTERACT_ACROSS_USERS_FULL)
- == PackageManager.PERMISSION_GRANTED;
- }
-
- private static boolean isCurrentProfile(@NonNull Context context, int uid) {
- long token = Binder.clearCallingIdentity();
- try {
- final int currentUser = ActivityManager.getCurrentUser();
- final int callingUserId = UserHandle.getUserId(uid);
- if (callingUserId == currentUser) {
- return true;
- } else {
- List<UserInfo> userProfiles = context.getSystemService(
- UserManager.class).getProfiles(currentUser);
- for (UserInfo user : userProfiles) {
- if (user.id == callingUserId) {
- return true;
- }
- }
- }
- return false;
- } finally {
- Binder.restoreCallingIdentity(token);
- }
- }
-}
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index 34f2dac028c7..debf43da79b4 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -612,9 +612,9 @@ public class SubscriptionManager {
* onSubscriptionsChanged overridden.
*/
public void addOnSubscriptionsChangedListener(OnSubscriptionsChangedListener listener) {
- String pkgName = mContext != null ? mContext.getOpPackageName() : "<unknown>";
+ String pkgForDebug = mContext != null ? mContext.getOpPackageName() : "<unknown>";
if (DBG) {
- logd("register OnSubscriptionsChangedListener pkgName=" + pkgName
+ logd("register OnSubscriptionsChangedListener pkgForDebug=" + pkgForDebug
+ " listener=" + listener);
}
try {
@@ -623,7 +623,7 @@ public class SubscriptionManager {
ITelephonyRegistry tr = ITelephonyRegistry.Stub.asInterface(ServiceManager.getService(
"telephony.registry"));
if (tr != null) {
- tr.addOnSubscriptionsChangedListener(pkgName, listener.callback);
+ tr.addOnSubscriptionsChangedListener(pkgForDebug, listener.callback);
}
} catch (RemoteException ex) {
// Should not happen
diff --git a/test-base/Android.bp b/test-base/Android.bp
index 343d49fa077e..b65cda9302a7 100644
--- a/test-base/Android.bp
+++ b/test-base/Android.bp
@@ -24,6 +24,9 @@ java_library {
srcs: ["src/**/*.java"],
+ // Needs to be consistent with the repackaged version of this make target.
+ java_version: "1.8",
+
no_framework_libs: true,
hostdex: true,
libs: [
@@ -55,13 +58,14 @@ java_library_static {
name: "repackaged.android.test.base",
static_libs: ["android.test.base"],
-
no_framework_libs: true,
libs: [
"framework",
],
jarjar_rules: "jarjar-rules.txt",
+ // Pin java_version until jarjar is certified to support later versions. http://b/72703434
+ java_version: "1.8",
}
// Build the android.test.base-minus-junit library
diff --git a/test-mock/Android.bp b/test-mock/Android.bp
index b1ae40e17b9d..54e07a1673e7 100644
--- a/test-mock/Android.bp
+++ b/test-mock/Android.bp
@@ -19,6 +19,8 @@
java_library {
name: "android.test.mock",
+ // Needs to be consistent with the repackaged version of this make target.
+ java_version: "1.8",
srcs: ["src/**/*.java"],
no_framework_libs: true,
@@ -35,4 +37,6 @@ java_library_static {
static_libs: ["android.test.mock"],
jarjar_rules: "jarjar-rules.txt",
+ // Pin java_version until jarjar is certified to support later versions. http://b/72703434
+ java_version: "1.8",
}
diff --git a/test-runner/Android.bp b/test-runner/Android.bp
index 1643a98b21b2..66b95271ee06 100644
--- a/test-runner/Android.bp
+++ b/test-runner/Android.bp
@@ -19,6 +19,8 @@
java_library {
name: "android.test.runner",
+ // Needs to be consistent with the repackaged version of this make target.
+ java_version: "1.8",
srcs: ["src/**/*.java"],
no_framework_libs: true,
@@ -55,4 +57,6 @@ java_library_static {
static_libs: ["android.test.runner"],
jarjar_rules: "jarjar-rules.txt",
+ // Pin java_version until jarjar is certified to support later versions. http://b/72703434
+ java_version: "1.8",
}
diff --git a/tests/net/java/android/net/MacAddressTest.java b/tests/net/java/android/net/MacAddressTest.java
index 9aad413c354b..04266c5b3a0f 100644
--- a/tests/net/java/android/net/MacAddressTest.java
+++ b/tests/net/java/android/net/MacAddressTest.java
@@ -172,7 +172,7 @@ public class MacAddressTest {
final int iterations = 1000;
final String expectedAndroidOui = "da:a1:19";
for (int i = 0; i < iterations; i++) {
- MacAddress mac = MacAddress.createRandomUnicastAddress();
+ MacAddress mac = MacAddress.createRandomUnicastAddressWithGoogleBase();
String stringRepr = mac.toString();
assertTrue(stringRepr + " expected to be a locally assigned address",
@@ -195,6 +195,15 @@ public class MacAddressTest {
assertTrue(stringRepr + " expected to begin with " + expectedLocalOui,
stringRepr.startsWith(expectedLocalOui));
}
+
+ for (int i = 0; i < iterations; i++) {
+ MacAddress mac = MacAddress.createRandomUnicastAddress();
+ String stringRepr = mac.toString();
+
+ assertTrue(stringRepr + " expected to be a locally assigned address",
+ mac.isLocallyAssigned());
+ assertEquals(MacAddress.TYPE_UNICAST, mac.getAddressType());
+ }
}
@Test
diff --git a/tools/sdkparcelables/src/com/android/sdkparcelables/AncestorCollector.kt b/tools/sdkparcelables/src/com/android/sdkparcelables/AncestorCollector.kt
index f278aec8eb6f..d75aea507980 100644
--- a/tools/sdkparcelables/src/com/android/sdkparcelables/AncestorCollector.kt
+++ b/tools/sdkparcelables/src/com/android/sdkparcelables/AncestorCollector.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package com.android.sdkparcelables
import org.objectweb.asm.ClassVisitor
@@ -25,4 +41,4 @@ class AncestorCollector(api: Int, dest: ClassVisitor?) : ClassVisitor(api, dest)
super.visit(version, access, name, signature, superName, interfaces)
}
-} \ No newline at end of file
+}
diff --git a/tools/sdkparcelables/src/com/android/sdkparcelables/Main.kt b/tools/sdkparcelables/src/com/android/sdkparcelables/Main.kt
index 3e9d92cd978f..22e8d781335b 100644
--- a/tools/sdkparcelables/src/com/android/sdkparcelables/Main.kt
+++ b/tools/sdkparcelables/src/com/android/sdkparcelables/Main.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package com.android.sdkparcelables
import org.objectweb.asm.ClassReader
@@ -53,4 +69,4 @@ fun main(args: Array<String>) {
fun usage() {
System.err.println("Usage: <input jar> <output aidl>")
kotlin.system.exitProcess(1)
-} \ No newline at end of file
+}
diff --git a/tools/sdkparcelables/src/com/android/sdkparcelables/ParcelableDetector.kt b/tools/sdkparcelables/src/com/android/sdkparcelables/ParcelableDetector.kt
index 620f798daf48..d6a0a4516a6d 100644
--- a/tools/sdkparcelables/src/com/android/sdkparcelables/ParcelableDetector.kt
+++ b/tools/sdkparcelables/src/com/android/sdkparcelables/ParcelableDetector.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package com.android.sdkparcelables
/** A class that uses an ancestor map to find all classes that
diff --git a/tools/sdkparcelables/tests/com/android/sdkparcelables/ParcelableDetectorTest.kt b/tools/sdkparcelables/tests/com/android/sdkparcelables/ParcelableDetectorTest.kt
index edfc8259a738..c9bcbc9cadcf 100644
--- a/tools/sdkparcelables/tests/com/android/sdkparcelables/ParcelableDetectorTest.kt
+++ b/tools/sdkparcelables/tests/com/android/sdkparcelables/ParcelableDetectorTest.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package com.android.sdkparcelables
import junit.framework.TestCase.assertEquals