Browse Source

Merge tag 'android-10.0.0_r31' of https://android.googlesource.com/platform/frameworks/base into ten

Android 10.0.0 release 31
ten
Ido Ben-Hur 1 year ago
parent
commit
af6fcd3620
No account linked to committer's email address
100 changed files with 9475 additions and 7955 deletions
  1. 3
    5
      Android.bp
  2. 18
    0
      Android.mk
  3. 2
    0
      cmds/statsd/Android.bp
  4. 18
    5
      cmds/statsd/src/StatsService.cpp
  5. 7
    1
      cmds/statsd/src/StatsService.h
  6. 91
    1
      cmds/statsd/src/atoms.proto
  7. 96
    0
      cmds/statsd/src/external/CarStatsPuller.cpp
  8. 36
    0
      cmds/statsd/src/external/CarStatsPuller.h
  9. 8
    0
      cmds/statsd/src/external/StatsPullerManager.cpp
  10. 2
    0
      cmds/statsd/src/main.cpp
  11. 5
    0
      core/java/Android.bp
  12. 31
    0
      core/java/android/accounts/AccountManager.java
  13. 1
    1
      core/java/android/animation/FloatEvaluator.java
  14. 1
    1
      core/java/android/app/ActivityManager.java
  15. 346
    0
      core/java/android/app/DisabledWallpaperManager.java
  16. 1
    0
      core/java/android/app/INotificationManager.aidl
  17. 3
    3
      core/java/android/app/NotificationManager.java
  18. 6
    1
      core/java/android/app/PendingIntent.java
  19. 16
    5
      core/java/android/app/SystemServiceRegistry.java
  20. 3
    1
      core/java/android/app/WallpaperManager.java
  21. 17
    1
      core/java/android/app/admin/DevicePolicyManager.java
  22. 4
    0
      core/java/android/app/backup/WallpaperBackupHelper.java
  23. 12
    1
      core/java/android/app/contentsuggestions/ContentSuggestionsManager.java
  24. 2
    0
      core/java/android/app/slice/SliceManager.java
  25. 91
    0
      core/java/android/bluetooth/BluetoothCodecConfig.java
  26. 37
    0
      core/java/android/bluetooth/BluetoothCodecStatus.java
  27. 0
    2
      core/java/android/bluetooth/le/ScanFilter.java
  28. 6
    0
      core/java/android/content/ComponentName.java
  29. 3
    0
      core/java/android/content/Intent.java
  30. 1
    1
      core/java/android/content/SyncStats.java
  31. 0
    13
      core/java/android/content/pm/PackageInstaller.java
  32. 73
    4
      core/java/android/content/pm/UserInfo.java
  33. 3
    2
      core/java/android/content/res/TypedArray.java
  34. 1
    1
      core/java/android/hardware/camera2/params/MandatoryStreamCombination.java
  35. 37
    16
      core/java/android/net/LinkProperties.java
  36. 2
    2
      core/java/android/net/nsd/NsdManager.java
  37. 31
    30
      core/java/android/os/BinderProxy.java
  38. 2
    1
      core/java/android/os/Build.java
  39. 1
    1
      core/java/android/os/FileObserver.java
  40. 1
    1
      core/java/android/os/IStatsManager.aidl
  41. 3
    1
      core/java/android/os/IUserManager.aidl
  42. 5
    64
      core/java/android/os/PowerManager.java
  43. 69
    22
      core/java/android/os/UserManager.java
  44. 58
    10
      core/java/android/provider/Settings.java
  45. 11
    2
      core/java/android/service/autofill/FillRequest.java
  46. 1
    0
      core/java/android/service/autofill/augmented/FillWindow.java
  47. 14
    5
      core/java/android/service/contentsuggestions/ContentSuggestionsService.java
  48. 15
    3
      core/java/android/service/notification/NotificationListenerService.java
  49. 3
    4
      core/java/android/util/DisplayMetrics.java
  50. 4
    2
      core/java/android/util/StatsLog.java
  51. 4
    0
      core/java/android/view/DisplayCutout.java
  52. 1
    18
      core/java/android/view/SurfaceControl.java
  53. 9
    9
      core/java/android/view/View.java
  54. 4
    4
      core/java/android/view/animation/AnimationUtils.java
  55. 10
    0
      core/java/android/view/autofill/AutofillManager.java
  56. 67
    30
      core/java/android/view/inputmethod/InputMethodManager.java
  57. 4
    1
      core/java/android/webkit/CookieManager.java
  58. 25
    9
      core/java/android/webkit/WebChromeClient.java
  59. 6
    1
      core/java/android/webkit/WebSettings.java
  60. 0
    3
      core/java/android/widget/ArrayAdapter.java
  61. 0
    4
      core/java/android/widget/ListView.java
  62. 2
    2
      core/java/android/widget/NumberPicker.java
  63. 1
    1
      core/java/android/widget/RelativeLayout.java
  64. 10
    0
      core/java/android/widget/TextView.java
  65. 41
    2
      core/java/com/android/internal/app/AbstractResolverComparator.java
  66. 182
    7
      core/java/com/android/internal/app/ChooserActivity.java
  67. 52
    9
      core/java/com/android/internal/app/ResolverActivity.java
  68. 11
    0
      core/java/com/android/internal/app/ResolverListController.java
  69. 24
    3
      core/java/com/android/internal/app/ResolverTargetActionsDialogFragment.java
  70. 31
    0
      core/java/com/android/internal/car/ICarStatsService.aidl
  71. 4
    2
      core/java/com/android/internal/colorextraction/ColorExtractor.java
  72. 14
    0
      core/java/com/android/internal/config/sysui/SystemUiDeviceConfigFlags.java
  73. 1
    0
      core/java/com/android/internal/os/BatteryStatsImpl.java
  74. 9
    7
      core/java/com/android/internal/util/ScreenshotHelper.java
  75. 24
    5
      core/jni/android/graphics/ByteBufferStreamAdaptor.cpp
  76. 1
    1
      core/jni/android_view_Surface.cpp
  77. 0
    11
      core/jni/android_view_SurfaceControl.cpp
  78. 5
    0
      core/proto/android/app/settings_enums.proto
  79. 1
    0
      core/proto/android/providers/settings/global.proto
  80. 5
    0
      core/proto/android/providers/settings/secure.proto
  81. 11
    0
      core/proto/android/service/notification.proto
  82. 4
    0
      core/res/AndroidManifest.xml
  83. 33
    0
      core/res/res/drawable/chooser_action_button_bg.xml
  84. 0
    25
      core/res/res/drawable/ic_content_copy_gm2.xml
  85. 21
    20
      core/res/res/drawable/ic_menu_copy_material.xml
  86. 30
    0
      core/res/res/layout/chooser_action_button.xml
  87. 26
    0
      core/res/res/layout/chooser_action_row.xml
  88. 9
    7
      core/res/res/layout/chooser_grid_preview_file.xml
  89. 10
    0
      core/res/res/layout/chooser_grid_preview_image.xml
  90. 12
    35
      core/res/res/layout/chooser_grid_preview_text.xml
  91. 2
    2
      core/res/res/values-af-watch/strings.xml
  92. 1890
    1879
      core/res/res/values-af/strings.xml
  93. 2
    2
      core/res/res/values-am-watch/strings.xml
  94. 1890
    1879
      core/res/res/values-am/strings.xml
  95. 2
    2
      core/res/res/values-ar-watch/strings.xml
  96. 1890
    1879
      core/res/res/values-ar/strings.xml
  97. 2
    2
      core/res/res/values-as-watch/strings.xml
  98. 1890
    1879
      core/res/res/values-as/strings.xml
  99. 2
    2
      core/res/res/values-az-watch/strings.xml
  100. 0
    0
      core/res/res/values-az/strings.xml

+ 3
- 5
Android.bp View File

@@ -321,7 +321,6 @@ java_defaults {
"core/java/android/service/vr/IVrManager.aidl",
"core/java/android/service/vr/IVrStateCallbacks.aidl",
"core/java/android/service/watchdog/IExplicitHealthCheckService.aidl",
"core/java/android/service/watchdog/PackageConfig.aidl",
"core/java/android/print/ILayoutResultCallback.aidl",
"core/java/android/print/IPrinterDiscoveryObserver.aidl",
"core/java/android/print/IPrintDocumentAdapter.aidl",
@@ -421,6 +420,7 @@ java_defaults {
"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/ICarStatsService.aidl",
"core/java/com/android/internal/inputmethod/IInputContentUriToken.aidl",
"core/java/com/android/internal/inputmethod/IInputMethodPrivilegedOperations.aidl",
"core/java/com/android/internal/inputmethod/IMultiClientInputMethod.aidl",
@@ -439,7 +439,6 @@ java_defaults {
"core/java/com/android/internal/os/IShellCallback.aidl",
"core/java/com/android/internal/statusbar/IStatusBar.aidl",
"core/java/com/android/internal/statusbar/IStatusBarService.aidl",
"core/java/com/android/internal/statusbar/RegisterStatusBarResult.aidl",
"core/java/com/android/internal/textservice/ISpellCheckerService.aidl",
"core/java/com/android/internal/textservice/ISpellCheckerServiceCallback.aidl",
"core/java/com/android/internal/textservice/ISpellCheckerSession.aidl",
@@ -1407,6 +1406,7 @@ droidstubs {
"core/res/AndroidManifest.xml",
],
args: metalava_framework_docs_args,
write_sdk_values: true,
}

droidstubs {
@@ -1416,6 +1416,7 @@ droidstubs {
"core/res/AndroidManifest.xml",
],
args: metalava_framework_docs_args + " --show-annotation android.annotation.SystemApi ",
write_sdk_values: true,
}

droiddoc {
@@ -1439,7 +1440,6 @@ droiddoc {
],
proofread_file: "offline-sdk-docs-proofrerad.txt",
args: framework_docs_only_args + " -offlinemode -title \"Android SDK\"",
write_sdk_values: true,
static_doc_index_redirect: "docs/docs-preview-index.html",
}

@@ -1457,7 +1457,6 @@ droiddoc {
],
proofread_file: "offline-sdk-referenceonly-docs-proofrerad.txt",
args: framework_docs_only_args + " -offlinemode -title \"Android SDK\" -referenceonly",
write_sdk_values: true,
static_doc_index_redirect: "docs/docs-documentation-redirect.html",
static_doc_properties: "docs/source.properties",
}
@@ -1477,7 +1476,6 @@ droiddoc {
proofread_file: "offline-system-sdk-referenceonly-docs-proofrerad.txt",
args: framework_docs_only_args + " -hide 101 -hide 104 -hide 108" +
" -offlinemode -title \"Android System SDK\" -referenceonly",
write_sdk_values: true,
static_doc_index_redirect: "docs/docs-documentation-redirect.html",
static_doc_properties: "docs/source.properties",
}

+ 18
- 0
Android.mk View File

@@ -54,6 +54,24 @@ $(OUT_DOCS)/offline-sdk-timestamp: $(OUT_DOCS)/offline-sdk-docs-docs.zip
.PHONY: docs offline-sdk-docs
docs offline-sdk-docs: $(OUT_DOCS)/offline-sdk-timestamp

SDK_METADATA_DIR :=$= $(call intermediates-dir-for,PACKAGING,framework-doc-stubs-metadata,,COMMON)
SDK_METADATA_FILES :=$= $(addprefix $(SDK_METADATA_DIR)/,\
activity_actions.txt \
broadcast_actions.txt \
categories.txt \
features.txt \
service_actions.txt \
widgets.txt)
SDK_METADATA :=$= $(firstword $(SDK_METADATA_FILES))
$(SDK_METADATA): .KATI_IMPLICIT_OUTPUTS := $(filter-out $(SDK_METADATA),$(SDK_METADATA_FILES))
$(SDK_METADATA): $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/framework-doc-stubs-metadata.zip
rm -rf $(SDK_METADATA_DIR)
mkdir -p $(SDK_METADATA_DIR)
unzip -qo $< -d $(SDK_METADATA_DIR)

.PHONY: framework-doc-stubs
framework-doc-stubs: $(SDK_METADATA)

# Run this for checkbuild
checkbuild: doc-comment-check-docs


+ 2
- 0
cmds/statsd/Android.bp View File

@@ -50,6 +50,7 @@ cc_defaults {

srcs: [
":statsd_aidl",
":ICarStatsService.aidl",
"src/active_config_list.proto",
"src/statsd_config.proto",
"src/uid_data.proto",
@@ -69,6 +70,7 @@ cc_defaults {
"src/config/ConfigKey.cpp",
"src/config/ConfigListener.cpp",
"src/config/ConfigManager.cpp",
"src/external/CarStatsPuller.cpp",
"src/external/GpuStatsPuller.cpp",
"src/external/Perfetto.cpp",
"src/external/Perfprofd.cpp",

+ 18
- 5
cmds/statsd/src/StatsService.cpp View File

@@ -266,7 +266,9 @@ status_t StatsService::onTransact(uint32_t code, const Parcel& data, Parcel* rep
IResultReceiver::asInterface(data.readStrongBinder());

err = command(in, out, err, args, resultReceiver);
resultReceiver->send(err);
if (resultReceiver != nullptr) {
resultReceiver->send(err);
}
return NO_ERROR;
}
default: { return BnStatsManager::onTransact(code, data, reply, flags); }
@@ -411,13 +413,20 @@ status_t StatsService::command(int in, int out, int err, Vector<String8>& args,
return cmd_trigger_active_config_broadcast(out, args);
}
if (!args[0].compare(String8("data-subscribe"))) {
if (mShellSubscriber == nullptr) {
mShellSubscriber = new ShellSubscriber(mUidMap, mPullerManager);
{
std::lock_guard<std::mutex> lock(mShellSubscriberMutex);
if (mShellSubscriber == nullptr) {
mShellSubscriber = new ShellSubscriber(mUidMap, mPullerManager);
}
}
int timeoutSec = -1;
if (argCount >= 2) {
timeoutSec = atoi(args[1].c_str());
}
if (resultReceiver == nullptr) {
ALOGI("Null resultReceiver given, no subscription will be started");
return UNEXPECTED_NULL;
}
mShellSubscriber->startNewSubscription(in, out, resultReceiver, timeoutSec);
return NO_ERROR;
}
@@ -1385,7 +1394,10 @@ Status StatsService::sendBinaryPushStateChangedAtom(const android::String16& tra

Status StatsService::sendWatchdogRollbackOccurredAtom(const int32_t rollbackTypeIn,
const android::String16& packageNameIn,
const int64_t packageVersionCodeIn) {
const int64_t packageVersionCodeIn,
const int32_t rollbackReasonIn,
const android::String16&
failingPackageNameIn) {
// Note: We skip the usage stats op check here since we do not have a package name.
// This is ok since we are overloading the usage_stats permission.
// This method only sends data, it does not receive it.
@@ -1407,7 +1419,8 @@ Status StatsService::sendWatchdogRollbackOccurredAtom(const int32_t rollbackType
}

android::util::stats_write(android::util::WATCHDOG_ROLLBACK_OCCURRED,
rollbackTypeIn, String8(packageNameIn).string(), packageVersionCodeIn);
rollbackTypeIn, String8(packageNameIn).string(), packageVersionCodeIn,
rollbackReasonIn, String8(failingPackageNameIn).string());

// Fast return to save disk read.
if (rollbackTypeIn != android::util::WATCHDOG_ROLLBACK_OCCURRED__ROLLBACK_TYPE__ROLLBACK_SUCCESS

+ 7
- 1
cmds/statsd/src/StatsService.h View File

@@ -200,7 +200,9 @@ public:
virtual Status sendWatchdogRollbackOccurredAtom(
const int32_t rollbackTypeIn,
const android::String16& packageNameIn,
const int64_t packageVersionCodeIn) override;
const int64_t packageVersionCodeIn,
const int32_t rollbackReasonIn,
const android::String16& failingPackageNameIn) override;

/**
* Binder call to get registered experiment IDs.
@@ -432,6 +434,10 @@ private:

sp<ShellSubscriber> mShellSubscriber;

/**
* Mutex for setting the shell subscriber
*/
mutable mutex mShellSubscriberMutex;
std::shared_ptr<LogEventQueue> mEventQueue;

FRIEND_TEST(StatsLogProcessorTest, TestActivationsPersistAcrossSystemServerRestart);

+ 91
- 1
cmds/statsd/src/atoms.proto View File

@@ -321,10 +321,11 @@ message Atom {
218 [(log_from_module) = "permissioncontroller"];
ExclusionRectStateChanged exclusion_rect_state_changed = 223;
BackGesture back_gesture_reported_reported = 224;
VmsClientConnectionStateChanged vms_client_connection_state_changed = 230;
}

// Pulled events will start at field 10000.
// Next: 10062
// Next: 10067
oneof pulled {
WifiBytesTransfer wifi_bytes_transfer = 10000;
WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
@@ -388,6 +389,8 @@ message Atom {
CoolingDevice cooling_device = 10059;
AppOps app_ops = 10060;
ProcessSystemIonHeapSize process_system_ion_heap_size = 10061;
VmsClientStats vms_client_stats = 10065;
NotificationRemoteViews notification_remote_views = 10066;
}

// DO NOT USE field numbers above 100,000 in AOSP.
@@ -1684,6 +1687,19 @@ message WatchdogRollbackOccurred {
optional string package_name = 2;

optional int32 package_version_code = 3;

enum RollbackReasonType {
REASON_UNKNOWN = 0;
REASON_NATIVE_CRASH = 1;
REASON_EXPLICIT_HEALTH_CHECK = 2;
REASON_APP_CRASH = 3;
REASON_APP_NOT_RESPONDING = 4;
}
optional RollbackReasonType rollback_reason = 4;

// Set by RollbackPackageHealthObserver to be the package that is failing when a rollback
// is initiated. Empty if the package is unknown.
optional string failing_package_name = 5;
}

/**
@@ -3708,6 +3724,33 @@ message RoleRequestResultReported {
optional Result result = 9;
}

/**
* Logs when a Vehicle Maps Service client's connection state has changed
*
* Logged from:
* packages/services/Car/service/src/com/android/car/stats/VmsClientLog.java
*/
message VmsClientConnectionStateChanged {
// The UID of the VMS client app
optional int32 uid = 1 [(is_uid) = true];

enum State {
UNKNOWN = 0;
// Attempting to connect to the client
CONNECTING = 1;
// Client connection established
CONNECTED = 2;
// Client connection closed unexpectedly
DISCONNECTED = 3;
// Client connection closed by VMS
TERMINATED = 4;
// Error establishing the client connection
CONNECTION_ERROR = 5;
}

optional State state = 2;
}

//////////////////////////////////////////////////////////////////////
// Pulled atoms below this line //
//////////////////////////////////////////////////////////////////////
@@ -4722,6 +4765,24 @@ message ProcStatsPkgProc {
optional ProcessStatsSectionProto proc_stats_section = 1;
}

// Next Tag: 2
message PackageRemoteViewInfoProto {
optional string package_name = 1;
// add per-package additional info here (like channels)
}

// Next Tag: 2
message NotificationRemoteViewsProto {
repeated PackageRemoteViewInfoProto package_remote_view_info = 1;
}

/**
* Pulled from NotificationManagerService.java
*/
message NotificationRemoteViews {
optional NotificationRemoteViewsProto notification_remote_views = 1;
}

message PowerProfileProto {
optional double cpu_suspend = 1;

@@ -6819,3 +6880,32 @@ message PermissionAppsFragmentViewed {
}
optional Category category = 6;
}

/**
* Pulls client metrics on data transferred via Vehicle Maps Service.
* Metrics are keyed by uid + layer.
*
* Pulled from:
* packages/services/Car/service/src/com/android/car/stats/CarStatsService.java
*/
message VmsClientStats {
// UID of the VMS client app
optional int32 uid = 1 [(is_uid) = true];

// VMS layer definition
optional int32 layer_type = 2;
optional int32 layer_channel = 3;
optional int32 layer_version = 4;

// Bytes and packets sent by the client for the layer
optional int64 tx_bytes = 5;
optional int64 tx_packets = 6;

// Bytes and packets received by the client for the layer
optional int64 rx_bytes = 7;
optional int64 rx_packets = 8;

// Bytes and packets dropped due to client error
optional int64 dropped_bytes = 9;
optional int64 dropped_packets = 10;
}

+ 96
- 0
cmds/statsd/src/external/CarStatsPuller.cpp View File

@@ -0,0 +1,96 @@
/*
* Copyright 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#define DEBUG false
#include "Log.h"

#include <binder/IServiceManager.h>
#include <com/android/internal/car/ICarStatsService.h>

#include "CarStatsPuller.h"
#include "logd/LogEvent.h"
#include "stats_log_util.h"

using android::binder::Status;
using com::android::internal::car::ICarStatsService;

namespace android {
namespace os {
namespace statsd {

static std::mutex gCarStatsMutex;
static sp<ICarStatsService> gCarStats = nullptr;

class CarStatsDeathRecipient : public android::IBinder::DeathRecipient {
public:
CarStatsDeathRecipient() = default;
~CarStatsDeathRecipient() override = default;

// android::IBinder::DeathRecipient override:
void binderDied(const android::wp<android::IBinder>& /* who */) override {
ALOGE("Car service has died");
std::lock_guard<std::mutex> lock(gCarStatsMutex);
if (gCarStats) {
sp<IBinder> binder = IInterface::asBinder(gCarStats);
binder->unlinkToDeath(this);
gCarStats = nullptr;
}
}
};

static sp<CarStatsDeathRecipient> gDeathRecipient = new CarStatsDeathRecipient();

static sp<ICarStatsService> getCarService() {
std::lock_guard<std::mutex> lock(gCarStatsMutex);
if (!gCarStats) {
const sp<IBinder> binder = defaultServiceManager()->checkService(String16("car_stats"));
if (!binder) {
ALOGW("Car service is unavailable");
return nullptr;
}
gCarStats = interface_cast<ICarStatsService>(binder);
binder->linkToDeath(gDeathRecipient);
}
return gCarStats;
}

CarStatsPuller::CarStatsPuller(const int tagId) : StatsPuller(tagId) {
}

bool CarStatsPuller::PullInternal(std::vector<std::shared_ptr<LogEvent>>* data) {
const sp<ICarStatsService> carService = getCarService();
if (!carService) {
return false;
}

vector<StatsLogEventWrapper> returned_value;
Status status = carService->pullData(mTagId, &returned_value);
if (!status.isOk()) {
ALOGW("CarStatsPuller::pull failed for %d", mTagId);
return false;
}

data->clear();
for (const StatsLogEventWrapper& it : returned_value) {
LogEvent::createLogEvents(it, *data);
}
VLOG("CarStatsPuller::pull succeeded for %d", mTagId);
return true;
}

} // namespace statsd
} // namespace os
} // namespace android

+ 36
- 0
cmds/statsd/src/external/CarStatsPuller.h View File

@@ -0,0 +1,36 @@
/*
* Copyright 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#pragma once

#include "StatsPuller.h"

namespace android {
namespace os {
namespace statsd {

/**
* Pull atoms from CarService.
*/
class CarStatsPuller : public StatsPuller {
public:
explicit CarStatsPuller(const int tagId);
bool PullInternal(std::vector<std::shared_ptr<LogEvent>>* data) override;
};

} // namespace statsd
} // namespace os
} // namespace android

+ 8
- 0
cmds/statsd/src/external/StatsPullerManager.cpp View File

@@ -27,6 +27,7 @@
#include "../logd/LogEvent.h"
#include "../stats_log_util.h"
#include "../statscompanion_util.h"
#include "CarStatsPuller.h"
#include "GpuStatsPuller.h"
#include "PowerStatsPuller.h"
#include "ResourceHealthManagerPuller.h"
@@ -266,6 +267,13 @@ std::map<int, PullAtomInfo> StatsPullerManager::kAllPullAtomInfo = {
// App ops
{android::util::APP_OPS,
{.puller = new StatsCompanionServicePuller(android::util::APP_OPS)}},
// VmsClientStats
{android::util::VMS_CLIENT_STATS,
{.additiveFields = {5, 6, 7, 8, 9, 10},
.puller = new CarStatsPuller(android::util::VMS_CLIENT_STATS)}},
// NotiifcationRemoteViews.
{android::util::NOTIFICATION_REMOTE_VIEWS,
{.puller = new StatsCompanionServicePuller(android::util::NOTIFICATION_REMOTE_VIEWS)}},
};

StatsPullerManager::StatsPullerManager() : mNextPullTimeNs(NO_ALARM_UPDATE) {

+ 2
- 0
cmds/statsd/src/main.cpp View File

@@ -53,6 +53,8 @@ void sigHandler(int sig) {
if (gStatsService != nullptr) {
gStatsService->Terminate();
}
ALOGW("statsd terminated on receiving signal %d.", sig);
exit(1);
}

void registerSigHandler()

+ 5
- 0
core/java/Android.bp View File

@@ -7,3 +7,8 @@ filegroup {
name: "IDropBoxManagerService.aidl",
srcs: ["com/android/internal/os/IDropBoxManagerService.aidl"],
}

filegroup {
name: "ICarStatsService.aidl",
srcs: ["com/android/internal/car/ICarStatsService.aidl"],
}

+ 31
- 0
core/java/android/accounts/AccountManager.java View File

@@ -565,6 +565,21 @@ public class AccountManager {
* account, or the AbstractAcccountAuthenticator managing the account did so or because the
* client shares a signature with the managing AbstractAccountAuthenticator.
*
* <div class="caution"><p><b>Caution: </b>This method returns personal and sensitive user data.
* If your app accesses, collects, uses, or shares personal and sensitive data, you must clearly
* disclose that fact to users. For apps published on Google Play, policies protecting user data
* require that you do the following:</p>
* <ul>
* <li>Disclose to the user how your app accesses, collects, uses, or shares personal and
* sensitive data. Learn more about
* <a href="https://play.google.com/about/privacy-security-deception/user-data/#!#personal-sensitive">acceptable
* disclosure and consent</a>.</li>
* <li>Provide a privacy policy that describes your use of this data on- and off-device.</li>
* </ul>
* <p>To learn more, visit the
* <a href="https://play.google.com/about/privacy-security-deception/user-data">Google Play
* Policy regarding user data</a>.</p></div>
*
* <p>
* It is safe to call this method from the main thread.
*
@@ -651,6 +666,22 @@ public class AccountManager {
* the account. For example, there are types corresponding to Google and Facebook. The exact
* string token to use will be published somewhere associated with the authenticator in
* question.
* </p>
*
* <div class="caution"><p><b>Caution: </b>This method returns personal and sensitive user data.
* If your app accesses, collects, uses, or shares personal and sensitive data, you must clearly
* disclose that fact to users. For apps published on Google Play, policies protecting user data
* require that you do the following:</p>
* <ul>
* <li>Disclose to the user how your app accesses, collects, uses, or shares personal and
* sensitive data. Learn more about
* <a href="https://play.google.com/about/privacy-security-deception/user-data/#!#personal-sensitive">acceptable
* disclosure and consent</a>.</li>
* <li>Provide a privacy policy that describes your use of this data on- and off-device.</li>
* </ul>
* <p>To learn more, visit the
* <a href="https://play.google.com/about/privacy-security-deception/user-data">Google Play
* Policy regarding user data</a>.</p></div>
*
* <p>
* It is safe to call this method from the main thread.

+ 1
- 1
core/java/android/animation/FloatEvaluator.java View File

@@ -24,7 +24,7 @@ public class FloatEvaluator implements TypeEvaluator<Number> {
/**
* This function returns the result of linearly interpolating the start and end values, with
* <code>fraction</code> representing the proportion between the start and end values. The
* calculation is a simple parametric calculation: <code>result = x0 + t * (v1 - v0)</code>,
* calculation is a simple parametric calculation: <code>result = x0 + t * (x1 - x0)</code>,
* where <code>x0</code> is <code>startValue</code>, <code>x1</code> is <code>endValue</code>,
* and <code>t</code> is <code>fraction</code>.
*

+ 1
- 1
core/java/android/app/ActivityManager.java View File

@@ -2897,7 +2897,7 @@ public class ActivityManager {
public static final int IMPORTANCE_CANT_SAVE_STATE_PRE_26 = 170;

/**
* Constant for {@link #importance}: This process is contains services
* Constant for {@link #importance}: This process contains services
* that should remain running. These are background services apps have
* started, not something the user is aware of, so they may be killed by
* the system relatively freely (though it is generally desired that they

+ 346
- 0
core/java/android/app/DisabledWallpaperManager.java View File

@@ -0,0 +1,346 @@
/*
* Copyright (C) 2019 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.annotation.NonNull;
import android.content.ComponentName;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.ParcelFileDescriptor;
import android.util.Log;

import java.io.IOException;
import java.io.InputStream;

/**
* A no-op implementation of {@link WallpaperManager}.
*/
final class DisabledWallpaperManager extends WallpaperManager {

private static final String TAG = DisabledWallpaperManager.class.getSimpleName();

// Don't need to worry about synchronization
private static DisabledWallpaperManager sInstance;

// TODO(b/138939803): STOPSHIP changed to false and/or remove it
private static final boolean DEBUG = true;

@NonNull
static DisabledWallpaperManager getInstance() {
if (sInstance == null) {
sInstance = new DisabledWallpaperManager();
}
return sInstance;
}

private DisabledWallpaperManager() {
super(null, null, null);
}

@Override
public boolean isWallpaperSupported() {
return false;
}

@Override
public boolean isSetWallpaperAllowed() {
return false;
}

// TODO(b/138939803): STOPSHIP methods below should not be necessary,
// callers should check if isWallpaperSupported(), consider removing them to keep this class
// simpler

private static <T> T unsupported() {
if (DEBUG) Log.w(TAG, "unsupported method called; returning null", new Exception());
return null;
}

private static boolean unsupportedBoolean() {
if (DEBUG) Log.w(TAG, "unsupported method called; returning false", new Exception());
return false;
}

@Override
public Drawable getDrawable() {
return unsupported();
}

@Override
public Drawable getBuiltInDrawable() {
return unsupported();
}

@Override
public Drawable getBuiltInDrawable(int which) {
return unsupported();
}

@Override
public Drawable getBuiltInDrawable(int outWidth, int outHeight, boolean scaleToFit,
float horizontalAlignment, float verticalAlignment) {
return unsupported();
}

@Override
public Drawable getBuiltInDrawable(int outWidth, int outHeight, boolean scaleToFit,
float horizontalAlignment, float verticalAlignment, int which) {
return unsupported();
}

@Override
public Drawable peekDrawable() {
return unsupported();
}

@Override
public Drawable getFastDrawable() {
return unsupported();
}

@Override
public Drawable peekFastDrawable() {
return unsupported();
}

@Override
public Bitmap getBitmap() {
return unsupported();
}

@Override
public Bitmap getBitmap(boolean hardware) {
return unsupported();
}

@Override
public Bitmap getBitmapAsUser(int userId, boolean hardware) {
return unsupported();
}

@Override
public ParcelFileDescriptor getWallpaperFile(int which) {
return unsupported();
}

@Override
public void addOnColorsChangedListener(OnColorsChangedListener listener, Handler handler) {
unsupported();
}

@Override
public void addOnColorsChangedListener(OnColorsChangedListener listener, Handler handler,
int userId) {
unsupported();
}

@Override
public void removeOnColorsChangedListener(OnColorsChangedListener callback) {
unsupported();
}

@Override
public void removeOnColorsChangedListener(OnColorsChangedListener callback, int userId) {
unsupported();
}

@Override
public WallpaperColors getWallpaperColors(int which) {
return unsupported();
}

@Override
public WallpaperColors getWallpaperColors(int which, int userId) {
return unsupported();
}

@Override
public ParcelFileDescriptor getWallpaperFile(int which, int userId) {
return unsupported();
}

@Override
public void forgetLoadedWallpaper() {
unsupported();
}

@Override
public WallpaperInfo getWallpaperInfo() {
return unsupported();
}

@Override
public WallpaperInfo getWallpaperInfo(int userId) {
return unsupported();
}

@Override
public int getWallpaperId(int which) {
return unsupported();
}

@Override
public int getWallpaperIdForUser(int which, int userId) {
return unsupported();
}

@Override
public Intent getCropAndSetWallpaperIntent(Uri imageUri) {
return unsupported();
}

@Override
public void setResource(int resid) throws IOException {
unsupported();
}

@Override
public int setResource(int resid, int which) throws IOException {
return unsupported();
}

@Override
public void setBitmap(Bitmap bitmap) throws IOException {
unsupported();
}

@Override
public int setBitmap(Bitmap fullImage, Rect visibleCropHint, boolean allowBackup)
throws IOException {
return unsupported();
}

@Override
public int setBitmap(Bitmap fullImage, Rect visibleCropHint, boolean allowBackup, int which)
throws IOException {
return unsupported();
}

@Override
public int setBitmap(Bitmap fullImage, Rect visibleCropHint, boolean allowBackup, int which,
int userId) throws IOException {
return unsupported();
}

@Override
public void setStream(InputStream bitmapData) throws IOException {
unsupported();
}

@Override
public int setStream(InputStream bitmapData, Rect visibleCropHint, boolean allowBackup)
throws IOException {
return unsupported();
}

@Override
public int setStream(InputStream bitmapData, Rect visibleCropHint, boolean allowBackup,
int which) throws IOException {
return unsupported();
}

@Override
public boolean hasResourceWallpaper(int resid) {
return unsupportedBoolean();
}

@Override
public int getDesiredMinimumWidth() {
return unsupported();
}

@Override
public int getDesiredMinimumHeight() {
return unsupported();
}

@Override
public void suggestDesiredDimensions(int minimumWidth, int minimumHeight) {
unsupported();
}

@Override
public void setDisplayPadding(Rect padding) {
unsupported();
}

@Override
public void setDisplayOffset(IBinder windowToken, int x, int y) {
unsupported();
}

@Override
public void clearWallpaper() {
unsupported();
}

@Override
public void clearWallpaper(int which, int userId) {
unsupported();
}

@Override
public boolean setWallpaperComponent(ComponentName name) {
return unsupportedBoolean();
}

@Override
public boolean setWallpaperComponent(ComponentName name, int userId) {
return unsupportedBoolean();
}

@Override
public void setWallpaperOffsets(IBinder windowToken, float xOffset, float yOffset) {
unsupported();
}

@Override
public void setWallpaperOffsetSteps(float xStep, float yStep) {
unsupported();
}

@Override
public void sendWallpaperCommand(IBinder windowToken, String action, int x, int y, int z,
Bundle extras) {
unsupported();
}

@Override
public void clearWallpaperOffsets(IBinder windowToken) {
unsupported();
}

@Override
public void clear() throws IOException {
unsupported();
}

@Override
public void clear(int which) throws IOException {
unsupported();
}

@Override
public boolean isWallpaperBackupEligible(int which) {
return unsupportedBoolean();
}
}

+ 1
- 0
core/java/android/app/INotificationManager.aidl View File

@@ -207,4 +207,5 @@ interface INotificationManager

void forceShowLedLight(int color);
void forcePulseLedLight(int color, int onTime, int offTime);
long pullStats(long startNs, int report, boolean doAgg, out List<ParcelFileDescriptor> stats);
}

+ 3
- 3
core/java/android/app/NotificationManager.java View File

@@ -1657,7 +1657,7 @@ public class NotificationManager {
@Override
public int hashCode() {
return Objects.hash(priorityCategories, priorityCallSenders, priorityMessageSenders,
suppressedVisualEffects);
suppressedVisualEffects, state);
}

@Override
@@ -1669,10 +1669,10 @@ public class NotificationManager {
&& other.priorityCallSenders == priorityCallSenders
&& other.priorityMessageSenders == priorityMessageSenders
&& suppressedVisualEffectsEqual(suppressedVisualEffects,
other.suppressedVisualEffects);
other.suppressedVisualEffects)
&& other.state == this.state;
}


private boolean suppressedVisualEffectsEqual(int suppressedEffects,
int otherSuppressedVisualEffects) {
if (suppressedEffects == otherSuppressedVisualEffects) {

+ 6
- 1
core/java/android/app/PendingIntent.java View File

@@ -1257,7 +1257,12 @@ public final class PendingIntent implements Parcelable {
return b != null ? new PendingIntent(b, in.getClassCookie(PendingIntent.class)) : null;
}

/*package*/ PendingIntent(IIntentSender target) {
/**
* Creates a PendingIntent with the given target.
* @param target the backing IIntentSender
* @hide
*/
public PendingIntent(IIntentSender target) {
mTarget = target;
}


+ 16
- 5
core/java/android/app/SystemServiceRegistry.java View File

@@ -695,11 +695,22 @@ final class SystemServiceRegistry {
@Override
public WallpaperManager createService(ContextImpl ctx)
throws ServiceNotFoundException {
final IBinder b;
if (ctx.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.P) {
b = ServiceManager.getServiceOrThrow(Context.WALLPAPER_SERVICE);
} else {
b = ServiceManager.getService(Context.WALLPAPER_SERVICE);
final IBinder b = ServiceManager.getService(Context.WALLPAPER_SERVICE);
if (b == null) {
// There are 2 reason service can be null:
// 1.Device doesn't support it - that's fine
// 2.App is running on instant mode - should fail
final boolean enabled = Resources.getSystem()
.getBoolean(com.android.internal.R.bool.config_enableWallpaperService);
if (!enabled) {
// Life moves on...
return DisabledWallpaperManager.getInstance();
}
if (ctx.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.P) {
// Instant app
throw new ServiceNotFoundException(Context.WALLPAPER_SERVICE);
}
// Bad state - WallpaperManager methods will throw exception
}
IWallpaperManager service = IWallpaperManager.Stub.asInterface(b);
return new WallpaperManager(service, ctx.getOuterContext(),

+ 3
- 1
core/java/android/app/WallpaperManager.java View File

@@ -510,7 +510,9 @@ public class WallpaperManager {

/*package*/ WallpaperManager(IWallpaperManager service, Context context, Handler handler) {
mContext = context;
initGlobals(service, context.getMainLooper());
if (service != null) {
initGlobals(service, context.getMainLooper());
}
}

/**

+ 17
- 1
core/java/android/app/admin/DevicePolicyManager.java View File

@@ -4032,9 +4032,17 @@ public class DevicePolicyManager {
* Make the device lock immediately, as if the lock screen timeout has expired at the point of
* this call.
* <p>
* This method secures the device in response to an urgent situation, such as a lost or stolen
* device. After this method is called, the device must be unlocked using strong authentication
* (PIN, pattern, or password). This API is intended for use only by device admins.
* <p>
* The calling device admin must have requested {@link DeviceAdminInfo#USES_POLICY_FORCE_LOCK}
* to be able to call this method; if it has not, a security exception will be thrown.
* <p>
* If there's no lock type set, this method forces the device to go to sleep but doesn't lock
* the device. Device admins who find the device in this state can lock an otherwise-insecure
* device by first calling {@link #resetPassword} to set the password and then lock the device.
* <p>
* This method can be called on the {@link DevicePolicyManager} instance returned by
* {@link #getParentProfileInstance(ComponentName)} in order to lock the parent profile.
* <p>
@@ -4051,9 +4059,17 @@ public class DevicePolicyManager {
* Make the device lock immediately, as if the lock screen timeout has expired at the point of
* this call.
* <p>
* This method secures the device in response to an urgent situation, such as a lost or stolen
* device. After this method is called, the device must be unlocked using strong authentication
* (PIN, pattern, or password). This API is intended for use only by device admins.
* <p>
* The calling device admin must have requested {@link DeviceAdminInfo#USES_POLICY_FORCE_LOCK}
* to be able to call this method; if it has not, a security exception will be thrown.
* <p>
* If there's no lock type set, this method forces the device to go to sleep but doesn't lock
* the device. Device admins who find the device in this state can lock an otherwise-insecure
* device by first calling {@link #resetPassword} to set the password and then lock the device.
* <p>
* This method can be called on the {@link DevicePolicyManager} instance returned by
* {@link #getParentProfileInstance(ComponentName)} in order to lock the parent profile.
*
@@ -8080,7 +8096,7 @@ public class DevicePolicyManager {
* Sets which system features are enabled when the device runs in lock task mode. This method
* doesn't affect the features when lock task mode is inactive. Any system features not included
* in {@code flags} are implicitly disabled when calling this method. By default, only
* {@link #LOCK_TASK_FEATURE_GLOBAL_ACTIONS} is enabledall the other features are disabled. To
* {@link #LOCK_TASK_FEATURE_GLOBAL_ACTIONS} is enabled; all the other features are disabled. To
* disable the global actions dialog, call this method omitting
* {@link #LOCK_TASK_FEATURE_GLOBAL_ACTIONS}.
*

+ 4
- 0
core/java/android/app/backup/WallpaperBackupHelper.java View File

@@ -85,6 +85,10 @@ public class WallpaperBackupHelper extends FileBackupHelperBase implements Backu
*/
@Override
public void restoreEntity(BackupDataInputStream data) {
if (mWpm == null) {
Slog.w(TAG, "restoreEntity(): no wallpaper service");
return;
}
final String key = data.getKey();
if (isKeyInList(key, mKeys)) {
if (key.equals(WALLPAPER_IMAGE_KEY)) {

+ 12
- 1
core/java/android/app/contentsuggestions/ContentSuggestionsManager.java View File

@@ -45,6 +45,17 @@ import java.util.concurrent.Executor;
*/
@SystemApi
public final class ContentSuggestionsManager {
/**
* Key into the extras Bundle passed to {@link #provideContextImage(int, Bundle)}.
* This can be used to provide the bitmap to
* {@link android.service.contentsuggestions.ContentSuggestionsService}.
* The value must be a {@link android.graphics.Bitmap} with the
* config {@link android.graphics.Bitmap.Config.HARDWARE}.
*
* @hide
*/
public static final String EXTRA_BITMAP = "android.contentsuggestions.extra.BITMAP";

private static final String TAG = ContentSuggestionsManager.class.getSimpleName();

/**
@@ -70,7 +81,7 @@ public final class ContentSuggestionsManager {
* system content suggestions service.
*
* @param taskId of the task to snapshot.
* @param imageContextRequestExtras sent with with request to provide implementation specific
* @param imageContextRequestExtras sent with request to provide implementation specific
* extra information.
*/
public void provideContextImage(

+ 2
- 0
core/java/android/app/slice/SliceManager.java View File

@@ -390,6 +390,8 @@ public class SliceManager {
}
Bundle extras = new Bundle();
extras.putParcelable(SliceProvider.EXTRA_INTENT, intent);
extras.putParcelableArrayList(SliceProvider.EXTRA_SUPPORTED_SPECS,
new ArrayList<>(supportedSpecs));
final Bundle res = provider.call(SliceProvider.METHOD_MAP_INTENT, null, extras);
if (res == null) {
return null;

+ 91
- 0
core/java/android/bluetooth/BluetoothCodecConfig.java View File

@@ -454,6 +454,43 @@ public final class BluetoothCodecConfig implements Parcelable {
}

/**
* Checks whether a value set presented by a bitmask has zero or single bit
*
* @param valueSet the value set presented by a bitmask
* @return true if the valueSet contains zero or single bit, otherwise false.
*/
private static boolean hasSingleBit(int valueSet) {
return (valueSet == 0 || (valueSet & (valueSet - 1)) == 0);
}

/**
* Checks whether the object contains none or single sample rate.
*
* @return true if the object contains none or single sample rate, otherwise false.
*/
public boolean hasSingleSampleRate() {
return hasSingleBit(mSampleRate);
}

/**
* Checks whether the object contains none or single bits per sample.
*
* @return true if the object contains none or single bits per sample, otherwise false.
*/
public boolean hasSingleBitsPerSample() {
return hasSingleBit(mBitsPerSample);
}

/**
* Checks whether the object contains none or single channel mode.
*
* @return true if the object contains none or single channel mode, otherwise false.
*/
public boolean hasSingleChannelMode() {
return hasSingleBit(mChannelMode);
}

/**
* Checks whether the audio feeding parameters are same.
*
* @param other the codec config to compare against
@@ -464,4 +501,58 @@ public final class BluetoothCodecConfig implements Parcelable {
&& other.mBitsPerSample == mBitsPerSample
&& other.mChannelMode == mChannelMode);
}

/**
* Checks whether another codec config has the similar feeding parameters.
* Any parameters with NONE value will be considered to be a wildcard matching.
*
* @param other the codec config to compare against
* @return true if the audio feeding parameters are similar, otherwise false.
*/
public boolean similarCodecFeedingParameters(BluetoothCodecConfig other) {
if (other == null || mCodecType != other.mCodecType) {
return false;
}
int sampleRate = other.mSampleRate;
if (mSampleRate == BluetoothCodecConfig.SAMPLE_RATE_NONE
|| sampleRate == BluetoothCodecConfig.SAMPLE_RATE_NONE) {
sampleRate = mSampleRate;
}
int bitsPerSample = other.mBitsPerSample;
if (mBitsPerSample == BluetoothCodecConfig.BITS_PER_SAMPLE_NONE
|| bitsPerSample == BluetoothCodecConfig.BITS_PER_SAMPLE_NONE) {
bitsPerSample = mBitsPerSample;
}
int channelMode = other.mChannelMode;
if (mChannelMode == BluetoothCodecConfig.CHANNEL_MODE_NONE
|| channelMode == BluetoothCodecConfig.CHANNEL_MODE_NONE) {
channelMode = mChannelMode;
}
return sameAudioFeedingParameters(new BluetoothCodecConfig(
mCodecType, /* priority */ 0, sampleRate, bitsPerSample, channelMode,
/* specific1 */ 0, /* specific2 */ 0, /* specific3 */ 0,
/* specific4 */ 0));
}

/**
* Checks whether the codec specific parameters are the same.
*
* @param other the codec config to compare against
* @return true if the codec specific parameters are the same, otherwise false.
*/
public boolean sameCodecSpecificParameters(BluetoothCodecConfig other) {
if (other == null && mCodecType != other.mCodecType) {
return false;
}
// Currently we only care about the LDAC Playback Quality at CodecSpecific1
switch (mCodecType) {
case SOURCE_CODEC_TYPE_LDAC:
if (mCodecSpecific1 != other.mCodecSpecific1) {
return false;
}
// fall through
default:
return true;
}
}
}

+ 37
- 0
core/java/android/bluetooth/BluetoothCodecStatus.java View File

@@ -89,6 +89,43 @@ public final class BluetoothCodecStatus implements Parcelable {
return Arrays.asList(c1).containsAll(Arrays.asList(c2));
}

/**
* Checks whether the codec config matches the selectable capabilities.
* Any parameters of the codec config with NONE value will be considered a wildcard matching.
*
* @param codecConfig the codec config to compare against
* @return true if the codec config matches, otherwise false
*/
public boolean isCodecConfigSelectable(BluetoothCodecConfig codecConfig) {
if (codecConfig == null || !codecConfig.hasSingleSampleRate()
|| !codecConfig.hasSingleBitsPerSample() || !codecConfig.hasSingleChannelMode()) {
return false;
}
for (BluetoothCodecConfig selectableConfig : mCodecsSelectableCapabilities) {
if (codecConfig.getCodecType() != selectableConfig.getCodecType()) {
continue;
}
int sampleRate = codecConfig.getSampleRate();
if ((sampleRate & selectableConfig.getSampleRate()) == 0
&& sampleRate != BluetoothCodecConfig.SAMPLE_RATE_NONE) {
continue;
}
int bitsPerSample = codecConfig.getBitsPerSample();
if ((bitsPerSample & selectableConfig.getBitsPerSample()) == 0
&& bitsPerSample != BluetoothCodecConfig.BITS_PER_SAMPLE_NONE) {
continue;
}
int channelMode = codecConfig.getChannelMode();
if ((channelMode & selectableConfig.getChannelMode()) == 0
&& channelMode != BluetoothCodecConfig.CHANNEL_MODE_NONE) {
continue;
}
return true;
}
return false;
}


@Override
public int hashCode() {
return Objects.hash(mCodecConfig, mCodecsLocalCapabilities,

+ 0
- 2
core/java/android/bluetooth/le/ScanFilter.java View File

@@ -671,8 +671,6 @@ public final class ScanFilter implements Parcelable {

/**
* Set filter on on manufacturerData. A negative manufacturerId is considered as invalid id.
* <p>
* Note the first two bytes of the {@code manufacturerData} is the manufacturerId.
*
* @throws IllegalArgumentException If the {@code manufacturerId} is invalid.
*/

+ 6
- 0
core/java/android/content/ComponentName.java View File

@@ -305,6 +305,12 @@ public final class ComponentName implements Parcelable, Cloneable, Comparable<Co
proto.end(token);
}

/**
* {@inheritDoc}
*
* <p>Two components are considered to be equal if the packages in which they reside have the
* same name, and if the classes that implement each component also have the same name.
*/
@Override
public boolean equals(Object obj) {
try {

+ 3
- 0
core/java/android/content/Intent.java View File

@@ -2677,6 +2677,9 @@ public class Intent implements Parcelable, Cloneable {
* that application is first launched (that is the first time it is moved
* out of the stopped state). The data contains the name of the package.
*
* <p>When the application is first launched, the application itself doesn't receive this
* broadcast.</p>
*
* <p class="note">This is a protected intent that can only be sent
* by the system.
*/

+ 1
- 1
core/java/android/content/SyncStats.java View File

@@ -58,7 +58,7 @@ public class SyncStats implements Parcelable {
* attempted to update or delete a version of a resource on the server. This is expected
* to clear itself automatically once the new state is retrieved from the server,
* though it may remain until the user intervenes manually, perhaps by clearing the
* local storage and starting over frmo scratch. This is considered a hard error.
* local storage and starting over from scratch. This is considered a hard error.
*/
public long numConflictDetectedExceptions;


+ 0
- 13
core/java/android/content/pm/PackageInstaller.java View File

@@ -101,19 +101,6 @@ import java.util.concurrent.Executor;
* <p>
* The ApiDemos project contains examples of using this API:
* <code>ApiDemos/src/com/example/android/apis/content/InstallApk*.java</code>.
* <p>
* On Android Q or above, an app installed notification will be posted
* by system after a new app is installed.
* To customize installer's notification icon, you should declare the following in the manifest
* &lt;application> as follows: </p>
* <pre>
* &lt;meta-data android:name="com.android.packageinstaller.notification.smallIcon"
* android:resource="@drawable/installer_notification_icon"/>
* </pre>
* <pre>
* &lt;meta-data android:name="com.android.packageinstaller.notification.color"
* android:resource="@color/installer_notification_color"/>
* </pre>
*/
public class PackageInstaller {
private static final String TAG = "PackageInstaller";

+ 73
- 4
core/java/android/content/pm/UserInfo.java View File

@@ -16,12 +16,17 @@

package android.content.pm;

import android.annotation.IntDef;
import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;
import android.util.DebugUtils;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/**
* Per-user information.
@@ -94,6 +99,25 @@ public class UserInfo implements Parcelable {
*/
public static final int FLAG_DEMO = 0x00000200;

/**
* @hide
*/
@IntDef(flag = true, prefix = "FLAG_", value = {
FLAG_PRIMARY,
FLAG_ADMIN,
FLAG_GUEST,
FLAG_RESTRICTED,
FLAG_INITIALIZED,
FLAG_MANAGED_PROFILE,
FLAG_DISABLED,
FLAG_QUIET_MODE,
FLAG_EPHEMERAL,
FLAG_DEMO
})
@Retention(RetentionPolicy.SOURCE)
public @interface UserInfoFlag {
}

public static final int NO_PROFILE_GROUP_ID = UserHandle.USER_NULL;

@UnsupportedAppUsage
@@ -128,6 +152,18 @@ public class UserInfo implements Parcelable {
@UnsupportedAppUsage
public boolean guestToRemove;

/**
* This is used to optimize the creation of an user, i.e. OEMs might choose to pre-create a
* number of users at the first boot, so the actual creation later is faster.
*
* <p>A {@code preCreated} user is not a real user yet, so it should not show up on regular
* user operations (other than user creation per se).
*
* <p>Once the pre-created is used to create a "real" user later on, {@code preCreate} is set to
* {@code false}.
*/
public boolean preCreated;

@UnsupportedAppUsage
public UserInfo(int id, String name, int flags) {
this(id, name, null, flags);
@@ -155,6 +191,13 @@ public class UserInfo implements Parcelable {

@UnsupportedAppUsage
public boolean isGuest() {
return isGuest(flags);
}

/**
* Checks if the flag denotes a guest user.
*/
public static boolean isGuest(@UserInfoFlag int flags) {
return (flags & FLAG_GUEST) == FLAG_GUEST;
}

@@ -165,6 +208,13 @@ public class UserInfo implements Parcelable {

@UnsupportedAppUsage
public boolean isManagedProfile() {
return isManagedProfile(flags);
}

/**
* Checks if the flag denotes a managed profile.
*/
public static boolean isManagedProfile(@UserInfoFlag int flags) {
return (flags & FLAG_MANAGED_PROFILE) == FLAG_MANAGED_PROFILE;
}

@@ -252,6 +302,7 @@ public class UserInfo implements Parcelable {
lastLoggedInTime = orig.lastLoggedInTime;
lastLoggedInFingerprint = orig.lastLoggedInFingerprint;
partial = orig.partial;
preCreated = orig.preCreated;
profileGroupId = orig.profileGroupId;
restrictedProfileParentId = orig.restrictedProfileParentId;
guestToRemove = orig.guestToRemove;
@@ -268,6 +319,22 @@ public class UserInfo implements Parcelable {
return "UserInfo{" + id + ":" + name + ":" + Integer.toHexString(flags) + "}";
}

/** @hide */
public String toFullString() {
return "UserInfo[id=" + id
+ ", name=" + name
+ ", flags=" + flagsToString(flags)
+ (preCreated ? " (pre-created)" : "")
+ (partial ? " (partial)" : "")
+ "]";
}

/** @hide */
public static String flagsToString(int flags) {
return DebugUtils.flagsToString(UserInfo.class, "FLAG_", flags);
}

@Override
public int describeContents() {
return 0;
}
@@ -281,9 +348,10 @@ public class UserInfo implements Parcelable {
dest.writeLong(creationTime);
dest.writeLong(lastLoggedInTime);
dest.writeString(lastLoggedInFingerprint);
dest.writeInt(partial ? 1 : 0);
dest.writeBoolean(partial);
dest.writeBoolean(preCreated);
dest.writeInt(profileGroupId);
dest.writeInt(guestToRemove ? 1 : 0);
dest.writeBoolean(guestToRemove);
dest.writeInt(restrictedProfileParentId);
dest.writeInt(profileBadge);
}
@@ -308,9 +376,10 @@ public class UserInfo implements Parcelable {
creationTime = source.readLong();
lastLoggedInTime = source.readLong();
lastLoggedInFingerprint = source.readString();
partial = source.readInt() != 0;
partial = source.readBoolean();
preCreated = source.readBoolean();
profileGroupId = source.readInt();
guestToRemove = source.readInt() != 0;
guestToRemove = source.readBoolean();
restrictedProfileParentId = source.readInt();
profileBadge = source.readInt();
}

+ 3
- 2
core/java/android/content/res/TypedArray.java View File

@@ -364,8 +364,9 @@ public class TypedArray {
/**
* Retrieve the boolean value for the attribute at <var>index</var>.
* <p>
* If the attribute is an integer value, this method will return whether
* it is equal to zero. If the attribute is not a boolean or integer value,
* If the attribute is an integer value, this method returns false if the
* attribute is equal to zero, and true otherwise.
* If the attribute is not a boolean or integer value,
* this method will attempt to coerce it to an integer using
* {@link Integer#decode(String)} and return whether it is equal to zero.
*

+ 1
- 1
core/java/android/hardware/camera2/params/MandatoryStreamCombination.java View File

@@ -1163,7 +1163,7 @@ public final class MandatoryStreamCombination {
if (orderedPreviewSizes != null) {
for (Size size : orderedPreviewSizes) {
if ((mDisplaySize.getWidth() >= size.getWidth()) &&
(mDisplaySize.getWidth() >= size.getHeight())) {
(mDisplaySize.getHeight() >= size.getHeight())) {
return size;
}
}

+ 37
- 16
core/java/android/net/LinkProperties.java View File

@@ -73,6 +73,8 @@ public final class LinkProperties implements Parcelable {
private static final int MIN_MTU_V6 = 1280;
private static final int MAX_MTU = 10000;

private static final int INET6_ADDR_LENGTH = 16;

// Stores the properties of links that are "stacked" above this link.
// Indexed by interface name to allow modification and to prevent duplicates being added.
private Hashtable<String, LinkProperties> mStackedLinks = new Hashtable<>();
@@ -1590,20 +1592,11 @@ public final class LinkProperties implements Parcelable {
dest.writeParcelable(linkAddress, flags);
}

dest.writeInt(mDnses.size());
for (InetAddress d : mDnses) {
dest.writeByteArray(d.getAddress());
}
dest.writeInt(mValidatedPrivateDnses.size());
for (InetAddress d : mValidatedPrivateDnses) {
dest.writeByteArray(d.getAddress());
}
writeAddresses(dest, mDnses);
writeAddresses(dest, mValidatedPrivateDnses);
dest.writeBoolean(mUsePrivateDns);
dest.writeString(mPrivateDnsServerName);
dest.writeInt(mPcscfs.size());
for (InetAddress d : mPcscfs) {
dest.writeByteArray(d.getAddress());
}
writeAddresses(dest, mPcscfs);
dest.writeString(mDomains);
dest.writeInt(mMtu);
dest.writeString(mTcpBufferSizes);
@@ -1624,6 +1617,35 @@ public final class LinkProperties implements Parcelable {
dest.writeList(stackedLinks);
}

private static void writeAddresses(@NonNull Parcel dest, @NonNull List<InetAddress> list) {
dest.writeInt(list.size());
for (InetAddress d : list) {
writeAddress(dest, d);
}
}

private static void writeAddress(@NonNull Parcel dest, @NonNull InetAddress addr) {
dest.writeByteArray(addr.getAddress());
if (addr instanceof Inet6Address) {
final Inet6Address v6Addr = (Inet6Address) addr;
final boolean hasScopeId = v6Addr.getScopeId() != 0;
dest.writeBoolean(hasScopeId);
if (hasScopeId) dest.writeInt(v6Addr.getScopeId());
}
}

@NonNull
private static InetAddress readAddress(@NonNull Parcel p) throws UnknownHostException {
final byte[] addr = p.createByteArray();
if (addr.length == INET6_ADDR_LENGTH) {
final boolean hasScopeId = p.readBoolean();
final int scopeId = hasScopeId ? p.readInt() : 0;
return Inet6Address.getByAddress(null /* host */, addr, scopeId);
}

return InetAddress.getByAddress(addr);
}

/**
* Implement the Parcelable interface.
*/
@@ -1643,14 +1665,13 @@ public final class LinkProperties implements Parcelable {
addressCount = in.readInt();
for (int i = 0; i < addressCount; i++) {
try {
netProp.addDnsServer(InetAddress.getByAddress(in.createByteArray()));
netProp.addDnsServer(readAddress(in));
} catch (UnknownHostException e) { }
}
addressCount = in.readInt();
for (int i = 0; i < addressCount; i++) {
try {
netProp.addValidatedPrivateDnsServer(
InetAddress.getByAddress(in.createByteArray()));
netProp.addValidatedPrivateDnsServer(readAddress(in));
} catch (UnknownHostException e) { }
}
netProp.setUsePrivateDns(in.readBoolean());
@@ -1658,7 +1679,7 @@ public final class LinkProperties implements Parcelable {
addressCount = in.readInt();
for (int i = 0; i < addressCount; i++) {
try {
netProp.addPcscfServer(InetAddress.getByAddress(in.createByteArray()));
netProp.addPcscfServer(readAddress(in));
} catch (UnknownHostException e) { }
}
netProp.setDomains(in.readString());

+ 2
- 2
core/java/android/net/nsd/NsdManager.java View File

@@ -49,8 +49,8 @@ import java.util.concurrent.CountDownLatch;
* limited to a local network over Multicast DNS. DNS service discovery is described at
* http://files.dns-sd.org/draft-cheshire-dnsext-dns-sd.txt
*
* <p> The API is asynchronous and responses to requests from an application are on listener
* callbacks on a seperate internal thread.
* <p> The API is asynchronous, and responses to requests from an application are on listener
* callbacks on a separate internal thread.
*
* <p> There are three main operations the API supports - registration, discovery and resolution.
* <pre>

+ 31
- 30
core/java/android/os/BinderProxy.java View File

@@ -241,31 +241,36 @@ public final class BinderProxy implements IBinder {
}

Map<String, Integer> counts = new HashMap<>();
for (ArrayList<WeakReference<BinderProxy>> a : mMainIndexValues) {
if (a != null) {
for (WeakReference<BinderProxy> weakRef : a) {
BinderProxy bp = weakRef.get();
String key;
if (bp == null) {
key = "<cleared weak-ref>";
} else {
try {
key = bp.getInterfaceDescriptor();
if ((key == null || key.isEmpty()) && !bp.isBinderAlive()) {
key = "<proxy to dead node>";
}
} catch (Throwable t) {
key = "<exception during getDescriptor>";
}
}
Integer i = counts.get(key);
if (i == null) {
counts.put(key, 1);
} else {
counts.put(key, i + 1);
final ArrayList<WeakReference<BinderProxy>> proxiesToQuery =
new ArrayList<WeakReference<BinderProxy>>();
synchronized (sProxyMap) {
for (ArrayList<WeakReference<BinderProxy>> a : mMainIndexValues) {
if (a != null) {
proxiesToQuery.addAll(a);
}
}
}
for (WeakReference<BinderProxy> weakRef : proxiesToQuery) {
BinderProxy bp = weakRef.get();
String key;
if (bp == null) {
key = "<cleared weak-ref>";
} else {
try {
key = bp.getInterfaceDescriptor();
if ((key == null || key.isEmpty()) && !bp.isBinderAlive()) {
key = "<proxy to dead node>";
}
} catch (Throwable t) {
key = "<exception during getDescriptor>";
}
}
Integer i = counts.get(key);
if (i == null) {
counts.put(key, 1);
} else {
counts.put(key, i + 1);
}
}
Map.Entry<String, Integer>[] sorted = counts.entrySet().toArray(
new Map.Entry[counts.size()]);
@@ -354,9 +359,7 @@ public final class BinderProxy implements IBinder {
* @hide
*/
public static InterfaceCount[] getSortedInterfaceCounts(int num) {
synchronized (sProxyMap) {
return sProxyMap.getSortedInterfaceCounts(num);
}
return sProxyMap.getSortedInterfaceCounts(num);
}

/**
@@ -375,11 +378,9 @@ public final class BinderProxy implements IBinder {
* @hide
*/
public static void dumpProxyDebugInfo() {
if (Build.IS_ENG) {
synchronized (sProxyMap) {
sProxyMap.dumpProxyInterfaceCounts();
sProxyMap.dumpPerUidProxyCounts();
}
if (Build.IS_DEBUGGABLE) {
sProxyMap.dumpProxyInterfaceCounts();
sProxyMap.dumpPerUidProxyCounts();
}
}


+ 2
- 1
core/java/android/os/Build.java View File

@@ -247,7 +247,8 @@ public class Build {
public static final String BASE_OS = SystemProperties.get("ro.build.version.base_os", "");

/**
* The user-visible security patch level.
* The user-visible security patch level. This value represents the date when the device
* most recently applied a security patch.
*/
public static final String SECURITY_PATCH = SystemProperties.get(
"ro.build.version.security_patch", "");

+ 1
- 1
core/java/android/os/FileObserver.java View File

@@ -32,7 +32,7 @@ import java.util.List;

/**
* Monitors files (using <a href="http://en.wikipedia.org/wiki/Inotify">inotify</a>)
* to fire an event after files are accessed or changed by by any process on
* to fire an event after files are accessed or changed by any process on
* the device (including this one). FileObserver is an abstract class;
* subclasses must implement the event handler {@link #onEvent(int, String)}.
*

+ 1
- 1
core/java/android/os/IStatsManager.aidl View File

@@ -224,7 +224,7 @@ interface IStatsManager {
* Logs an event for watchdog rollbacks.
*/
oneway void sendWatchdogRollbackOccurredAtom(in int rollbackType, in String packageName,
in long packageVersionCode);
in long packageVersionCode, in int rollbackReason, in String failingPackageName);

/**
* Returns the most recently registered experiment IDs.

+ 3
- 1
core/java/android/os/IUserManager.aidl View File

@@ -41,6 +41,7 @@ interface IUserManager {
*/

UserInfo createUser(in String name, int flags);
UserInfo preCreateUser(int flags);
UserInfo createProfileForUser(in String name, int flags, int userHandle,
in String[] disallowedPackages);
UserInfo createRestrictedProfile(String name, int parentUserHandle);
@@ -53,7 +54,7 @@ interface IUserManager {
void setUserIcon(int userHandle, in Bitmap icon);
ParcelFileDescriptor getUserIcon(int userHandle);
UserInfo getPrimaryUser();
List<UserInfo> getUsers(boolean excludeDying);
List<UserInfo> getUsers(boolean excludePartial, boolean excludeDying, boolean excludePreCreated);
List<UserInfo> getProfiles(int userHandle, boolean enabledOnly);
int[] getProfileIds(int userId, boolean enabledOnly);
boolean canAddMoreManagedProfiles(int userHandle, boolean allowedToRemoveOne);
@@ -92,6 +93,7 @@ interface IUserManager {
boolean someUserHasSeedAccount(in String accountName, in String accountType);
boolean isManagedProfile(int userId);
boolean isDemoUser(int userId);
boolean isPreCreated(int userId);
UserInfo createProfileForUserEvenWhenDisallowed(in String name, int flags, int userHandle,
in String[] disallowedPackages);
boolean isUserUnlockingOrUnlocked(int userId);

+ 5
- 64
core/java/android/os/PowerManager.java View File

@@ -44,70 +44,10 @@ import java.util.concurrent.Executor;
* <p>
* <b>Device battery life will be significantly affected by the use of this API.</b>
* Do not acquire {@link WakeLock}s unless you really need them, use the minimum levels
* possible, and be sure to release them as soon as possible.
* </p><p>
* The primary API you'll use is {@link #newWakeLock(int, String) newWakeLock()}.
* This will create a {@link PowerManager.WakeLock} object. You can then use methods
* on the wake lock object to control the power state of the device.
* </p><p>
* In practice it's quite simple:
* {@samplecode
* PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
* PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "My Tag");
* wl.acquire();
* ..screen will stay on during this section..
* wl.release();
* }
* </p><p>
* The following wake lock levels are defined, with varying effects on system power.
* <i>These levels are mutually exclusive - you may only specify one of them.</i>
* possible, and be sure to release them as soon as possible. In most cases,
* you'll want to use
* {@link android.view.WindowManager.LayoutParams#FLAG_KEEP_SCREEN_ON} instead.
*
* <table>
* <tr><th>Flag Value</th>
* <th>CPU</th> <th>Screen</th> <th>Keyboard</th></tr>
*
* <tr><td>{@link #PARTIAL_WAKE_LOCK}</td>
* <td>On*</td> <td>Off</td> <td>Off</td>
* </tr>
*
* <tr><td>{@link #SCREEN_DIM_WAKE_LOCK}</td>
* <td>On</td> <td>Dim</td> <td>Off</td>
* </tr>
*
* <tr><td>{@link #SCREEN_BRIGHT_WAKE_LOCK}</td>
* <td>On</td> <td>Bright</td> <td>Off</td>
* </tr>
*
* <tr><td>{@link #FULL_WAKE_LOCK}</td>
* <td>On</td> <td>Bright</td> <td>Bright</td>
* </tr>
* </table>
* </p><p>
* *<i>If you hold a partial wake lock, the CPU will continue to run, regardless of any
* display timeouts or the state of the screen and even after the user presses the power button.
* In all other wake locks, the CPU will run, but the user can still put the device to sleep
* using the power button.</i>
* </p><p>
* In addition, you can add two more flags, which affect behavior of the screen only.
* <i>These flags have no effect when combined with a {@link #PARTIAL_WAKE_LOCK}.</i></p>
*
* <table>
* <tr><th>Flag Value</th> <th>Description</th></tr>
*
* <tr><td>{@link #ACQUIRE_CAUSES_WAKEUP}</td>
* <td>Normal wake locks don't actually turn on the illumination. Instead, they cause
* the illumination to remain on once it turns on (e.g. from user activity). This flag
* will force the screen and/or keyboard to turn on immediately, when the WakeLock is
* acquired. A typical use would be for notifications which are important for the user to
* see immediately.</td>
* </tr>
*
* <tr><td>{@link #ON_AFTER_RELEASE}</td>
* <td>If this flag is set, the user activity timer will be reset when the WakeLock is
* released, causing the illumination to remain on a bit longer. This can be used to
* reduce flicker if you are cycling between wake lock conditions.</td>
* </tr>
* </table>
* <p>
* Any application using a WakeLock must request the {@code android.permission.WAKE_LOCK}
* permission in an {@code <uses-permission>} element of the application's manifest.
@@ -948,7 +888,8 @@ public final class PowerManager {
* {@link #FULL_WAKE_LOCK}, {@link #SCREEN_DIM_WAKE_LOCK}
* and {@link #SCREEN_BRIGHT_WAKE_LOCK}. Exactly one wake lock level must be
* specified as part of the {@code levelAndFlags} parameter.
* </p><p>
* </p>
* <p>
* The wake lock flags are: {@link #ACQUIRE_CAUSES_WAKEUP}
* and {@link #ON_AFTER_RELEASE}. Multiple flags can be combined as part of the
* {@code levelAndFlags} parameters.

+ 69
- 22
core/java/android/os/UserManager.java View File

@@ -37,6 +37,7 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.content.IntentSender;
import android.content.pm.UserInfo;
import android.content.pm.UserInfo.UserInfoFlag;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Bitmap;
@@ -2003,18 +2004,20 @@ public class UserManager {

/**
* Creates a user with the specified name and options. For non-admin users, default user
* restrictions are going to be applied.
* Requires {@link android.Manifest.permission#MANAGE_USERS} permission.
* restrictions will be applied.
*
* <p>Requires {@link android.Manifest.permission#MANAGE_USERS} permission.
*
* @param name the user's name
* @param flags flags that identify the type of user and other properties.
* @param flags UserInfo flags that identify the type of user and other properties.
* @see UserInfo
*
* @return the UserInfo object for the created user, or null if the user could not be created.
* @return the UserInfo object for the created user, or {@code null} if the user could not be
* created.
* @hide
*/
@UnsupportedAppUsage
public UserInfo createUser(String name, int flags) {
public @Nullable UserInfo createUser(@Nullable String name, @UserInfoFlag int flags) {
UserInfo user = null;
try {
user = mService.createUser(name, flags);
@@ -2031,6 +2034,44 @@ public class UserManager {
}

/**
* Pre-creates a user with the specified name and options. For non-admin users, default user
* restrictions will be applied.
*
* <p>This method can be used by OEMs to "warm" up the user creation by pre-creating some users
* at the first boot, so they when the "real" user is created (for example,
* by {@link #createUser(String, int)} or {@link #createGuest(Context, String)}), it takes
* less time.
*
* <p>This method completes the majority of work necessary for user creation: it
* creates user data, CE and DE encryption keys, app data directories, initializes the user and
* grants default permissions. When pre-created users become "real" users, only then are
* components notified of new user creation by firing user creation broadcasts.
*
* <p>All pre-created users are removed during system upgrade.
*
* <p>Requires {@link android.Manifest.permission#MANAGE_USERS} permission.
*
* @param flags UserInfo flags that identify the type of user and other properties.
* @see UserInfo
*
* @return the UserInfo object for the created user, or {@code null} if the user could not be
* created.
*
* @throw {@link IllegalArgumentException} if {@code flags} contains
* {@link UserInfo#FLAG_MANAGED_PROFILE}.
*
* @hide
*/
@RequiresPermission(android.Manifest.permission.MANAGE_USERS)
public @Nullable UserInfo preCreateUser(@UserInfoFlag int flags) {
try {
return mService.preCreateUser(flags);
} catch (RemoteException re) {
throw re.rethrowFromSystemServer();
}
}

/**
* Creates a guest user and configures it.
* @param context an application context
* @param name the name to set for the user
@@ -2337,6 +2378,8 @@ public class UserManager {

/**
* Return the number of users currently created on the device.
* <p>This API is not for use by third-party apps. It requires the {@code MANAGE_USERS}
* permission.</p>
*/
public int getUserCount() {
List<UserInfo> users = getUsers();
@@ -2346,15 +2389,26 @@ public class UserManager {
/**
* Returns information for all users on this device, including ones marked for deletion.
* To retrieve only users that are alive, use {@link #getUsers(boolean)}.
* <p>
* Requires {@link android.Manifest.permission#MANAGE_USERS} permission.
*
* @return the list of users that exist on the device.
* @hide
*/
@UnsupportedAppUsage
@RequiresPermission(android.Manifest.permission.MANAGE_USERS)
public List<UserInfo> getUsers() {
return getUsers(/* excludeDying= */ false);
}

/**
* Returns information for all users on this device, based on the filtering parameters.
*
* @hide
*/
@RequiresPermission(android.Manifest.permission.MANAGE_USERS)
public List<UserInfo> getUsers(boolean excludePartial, boolean excludeDying,
boolean excludePreCreated) {
try {
return mService.getUsers(false);
return mService.getUsers(excludePartial, excludeDying, excludePreCreated);
} catch (RemoteException re) {
throw re.rethrowFromSystemServer();
}
@@ -2370,16 +2424,12 @@ public class UserManager {
@SystemApi
@RequiresPermission(android.Manifest.permission.MANAGE_USERS)
public long[] getSerialNumbersOfUsers(boolean excludeDying) {
try {
List<UserInfo> users = mService.getUsers(excludeDying);
long[] result = new long[users.size()];
for (int i = 0; i < result.length; i++) {
result[i] = users.get(i).serialNumber;
}
return result;
} catch (RemoteException re) {
throw re.rethrowFromSystemServer();
List<UserInfo> users = getUsers(excludeDying);
long[] result = new long[users.size()];
for (int i = 0; i < result.length; i++) {
result[i] = users.get(i).serialNumber;
}
return result;
}

/**
@@ -2765,11 +2815,8 @@ public class UserManager {
*/
@UnsupportedAppUsage
public @NonNull List<UserInfo> getUsers(boolean excludeDying) {
try {
return mService.getUsers(excludeDying);
} catch (RemoteException re) {