Merge "BatteryStateNotifier: Update PendingIntent flag"
diff --git a/OWNERS b/OWNERS
new file mode 100644
index 0000000..4f89f7d
--- /dev/null
+++ b/OWNERS
@@ -0,0 +1,24 @@
+# This top-level list should remain narrowly defined as team leads; individual
+# teams are strongly encouraged to define narrower OWNERS files at deeper
+# levels within the source tree; see OWNERS.md for more details
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
+
+# Support bulk translation updates
+per-file */res*/values*/*.xml = [email protected]
+
+per-file Android.bp = file:platform/build/soong:/OWNERS
+per-file Android.mk = file:platform/build/soong:/OWNERS
+per-file ApiDocs.bp = file:platform/build/soong:/OWNERS
+per-file StubLibraries.bp = file:platform/build/soong:/OWNERS
diff --git a/OWNERS.md b/OWNERS.md
new file mode 100644
index 0000000..6428c59
--- /dev/null
+++ b/OWNERS.md
@@ -0,0 +1,34 @@
+As general background, `OWNERS` files expedite code reviews by helping code
+authors quickly find relevant reviewers, and they also ensure that stakeholders
+are involved in code changes in their areas.
+
+The structure of `frameworks/base/` is unique among Android repositories, and
+it's evolved into a complex interleaved structure over the years. Because of
+this structure, the best place to authoritatively define `OWNERS` can vary
+wildly, but here are some common patterns:
+
+* `core/java/` contains source that is included in the base classpath, and as
+such it's where most APIs are defined:
+ * `core/java/android/app/`
+ * `core/java/android/content/`
+* `services/core/` contains most system services, and these directories
+typically have more granularity than `core/java/`, since they can be refactored
+without API changes:
+ * `services/core/java/com/android/server/net/`
+ * `services/core/java/com/android/server/wm/`
+* `services/` contains several system services that have been isolated from the
+main `services/core/` project:
+ * `services/appwidget/`
+ * `services/midi/`
+* `apex/` contains Mainline modules:
+ * `apex/jobscheduler/`
+ * `apex/permission/`
+* Finally, some teams may have dedicated top-level directories:
+ * `media/`
+ * `wifi/`
+
+Area maintainers are strongly encouraged to list people in a single
+authoritative `OWNERS` file in **exactly one** location. Then, other paths
+should reference that single authoritative `OWNERS` file using an include
+directive. This approach ensures that updates are applied consistently across
+the tree, reducing maintenance burden.
diff --git a/ZYGOTE_OWNERS b/ZYGOTE_OWNERS
new file mode 100644
index 0000000..90a185b
--- /dev/null
+++ b/ZYGOTE_OWNERS
@@ -0,0 +1,5 @@
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/apct-tests/perftests/OWNERS b/apct-tests/perftests/OWNERS
new file mode 100644
index 0000000..a060ad9
--- /dev/null
+++ b/apct-tests/perftests/OWNERS
@@ -0,0 +1,2 @@
[email protected]
[email protected]
diff --git a/apct-tests/perftests/autofill/OWNERS b/apct-tests/perftests/autofill/OWNERS
new file mode 100644
index 0000000..c52751d
--- /dev/null
+++ b/apct-tests/perftests/autofill/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/service/autofill/OWNERS
diff --git a/apct-tests/perftests/blobstore/OWNERS b/apct-tests/perftests/blobstore/OWNERS
new file mode 100644
index 0000000..65bb6b8
--- /dev/null
+++ b/apct-tests/perftests/blobstore/OWNERS
@@ -0,0 +1 @@
+include /apex/blobstore/OWNERS
diff --git a/apct-tests/perftests/contentcapture/OWNERS b/apct-tests/perftests/contentcapture/OWNERS
new file mode 100644
index 0000000..a28e00a
--- /dev/null
+++ b/apct-tests/perftests/contentcapture/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/service/contentcapture/OWNERS
diff --git a/apct-tests/perftests/core/apps/overlay/OWNERS b/apct-tests/perftests/core/apps/overlay/OWNERS
new file mode 100644
index 0000000..afb98d4
--- /dev/null
+++ b/apct-tests/perftests/core/apps/overlay/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/content/om/OWNERS
diff --git a/apct-tests/perftests/core/src/android/accounts/OWNERS b/apct-tests/perftests/core/src/android/accounts/OWNERS
new file mode 100644
index 0000000..df1b4f4
--- /dev/null
+++ b/apct-tests/perftests/core/src/android/accounts/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/accounts/OWNERS
diff --git a/apct-tests/perftests/core/src/android/database/OWNERS b/apct-tests/perftests/core/src/android/database/OWNERS
new file mode 100644
index 0000000..bb9a2ca
--- /dev/null
+++ b/apct-tests/perftests/core/src/android/database/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/database/OWNERS
diff --git a/apct-tests/perftests/inputmethod/OWNERS b/apct-tests/perftests/inputmethod/OWNERS
new file mode 100644
index 0000000..5deb2ce
--- /dev/null
+++ b/apct-tests/perftests/inputmethod/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/view/inputmethod/OWNERS
diff --git a/apct-tests/perftests/packagemanager/OWNERS b/apct-tests/perftests/packagemanager/OWNERS
new file mode 100644
index 0000000..d825dfd
--- /dev/null
+++ b/apct-tests/perftests/packagemanager/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/pm/OWNERS
diff --git a/apct-tests/perftests/textclassifier/OWNERS b/apct-tests/perftests/textclassifier/OWNERS
new file mode 100644
index 0000000..46b3cb8
--- /dev/null
+++ b/apct-tests/perftests/textclassifier/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/service/textclassifier/OWNERS
diff --git a/apct-tests/perftests/windowmanager/OWNERS b/apct-tests/perftests/windowmanager/OWNERS
new file mode 100644
index 0000000..0862c05
--- /dev/null
+++ b/apct-tests/perftests/windowmanager/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/wm/OWNERS
diff --git a/apex/appsearch/OWNERS b/apex/appsearch/OWNERS
new file mode 100644
index 0000000..ce0c212
--- /dev/null
+++ b/apex/appsearch/OWNERS
@@ -0,0 +1 @@
[email protected]
diff --git a/apex/jobscheduler/OWNERS b/apex/jobscheduler/OWNERS
index d004eed..0fe6cdf 100644
--- a/apex/jobscheduler/OWNERS
+++ b/apex/jobscheduler/OWNERS
@@ -1,6 +1,6 @@
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
\ No newline at end of file
diff --git a/apex/jobscheduler/framework/java/android/app/job/OWNERS b/apex/jobscheduler/framework/java/android/app/job/OWNERS
new file mode 100644
index 0000000..b4a45f5
--- /dev/null
+++ b/apex/jobscheduler/framework/java/android/app/job/OWNERS
@@ -0,0 +1,7 @@
+# Bug component: 330738
+
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java b/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java
index 9ea402c..99a9b97 100644
--- a/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java
+++ b/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java
@@ -2044,7 +2044,6 @@
}
maybeRunPendingJobsLocked();
- // Don't remove JOB_EXPIRED in case one came along while processing the queue.
}
}
}
@@ -2110,6 +2109,15 @@
* as many as we can.
*/
private void queueReadyJobsForExecutionLocked() {
+ // This method will check and capture all ready jobs, so we don't need to keep any messages
+ // in the queue.
+ mHandler.removeMessages(MSG_CHECK_JOB_GREEDY);
+ // MSG_CHECK_JOB is a weaker form of _GREEDY. Since we're checking and queueing all ready
+ // jobs, we don't need to keep any MSG_CHECK_JOB messages in the queue.
+ mHandler.removeMessages(MSG_CHECK_JOB);
+ // This method will capture all expired jobs that are ready, so there's no need to keep
+ // the _EXPIRED messages in the queue.
+ mHandler.removeMessages(MSG_JOB_EXPIRED);
if (DEBUG) {
Slog.d(TAG, "queuing all ready jobs for execution:");
}
diff --git a/apex/permission/apex_manifest.json b/apex/permission/apex_manifest.json
index 7960598..6350d54 100644
--- a/apex/permission/apex_manifest.json
+++ b/apex/permission/apex_manifest.json
@@ -1,4 +1,4 @@
{
"name": "com.android.permission",
- "version": 300000000
+ "version": 309999999
}
diff --git a/apex/statsd/.clang-format b/apex/statsd/.clang-format
deleted file mode 100644
index cead3a0..0000000
--- a/apex/statsd/.clang-format
+++ /dev/null
@@ -1,17 +0,0 @@
-BasedOnStyle: Google
-AllowShortIfStatementsOnASingleLine: true
-AllowShortFunctionsOnASingleLine: false
-AllowShortLoopsOnASingleLine: true
-BinPackArguments: true
-BinPackParameters: true
-ColumnLimit: 100
-CommentPragmas: NOLINT:.*
-ContinuationIndentWidth: 8
-DerivePointerAlignment: false
-IndentWidth: 4
-PointerAlignment: Left
-TabWidth: 4
-AccessModifierOffset: -4
-IncludeCategories:
- - Regex: '^"Log\.h"'
- Priority: -1
diff --git a/apex/statsd/Android.bp b/apex/statsd/Android.bp
deleted file mode 100644
index f13861e..0000000
--- a/apex/statsd/Android.bp
+++ /dev/null
@@ -1,83 +0,0 @@
-// 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.
-
-apex {
- name: "com.android.os.statsd",
- defaults: ["com.android.os.statsd-defaults"],
- manifest: "apex_manifest.json",
-}
-
-apex_defaults {
- jni_libs: [
- "libstats_jni",
- ],
- native_shared_libs: [
- "libstatspull",
- "libstatssocket",
- ],
- binaries: ["statsd"],
- java_libs: [
- "framework-statsd",
- "service-statsd",
- ],
- compile_multilib: "both",
- prebuilts: ["com.android.os.statsd.init.rc"],
- name: "com.android.os.statsd-defaults",
- updatable: true,
- min_sdk_version: "30",
- key: "com.android.os.statsd.key",
- certificate: ":com.android.os.statsd.certificate",
-}
-
-apex_key {
- name: "com.android.os.statsd.key",
- public_key: "com.android.os.statsd.avbpubkey",
- private_key: "com.android.os.statsd.pem",
-}
-
-android_app_certificate {
- name: "com.android.os.statsd.certificate",
- // This will use com.android.os.statsd.x509.pem (the cert) and
- // com.android.os.statsd.pk8 (the private key)
- certificate: "com.android.os.statsd",
-}
-
-prebuilt_etc {
- name: "com.android.os.statsd.init.rc",
- src: "statsd.rc",
- filename: "init.rc",
- installable: false,
-}
-
-// JNI library for StatsLog.write
-cc_library_shared {
- name: "libstats_jni",
- srcs: ["jni/**/*.cpp"],
- header_libs: ["libnativehelper_header_only"],
- shared_libs: [
- "liblog", // Has a stable abi - should not be copied into apex.
- "libstatssocket",
- ],
- stl: "libc++_static",
- cflags: [
- "-Wall",
- "-Werror",
- "-Wextra",
- "-Wno-unused-parameter",
- ],
- apex_available: [
- "com.android.os.statsd",
- "test_com.android.os.statsd",
- ],
-}
diff --git a/apex/statsd/OWNERS b/apex/statsd/OWNERS
deleted file mode 100644
index bed9600..0000000
--- a/apex/statsd/OWNERS
+++ /dev/null
@@ -1,9 +0,0 @@
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
\ No newline at end of file
diff --git a/apex/statsd/TEST_MAPPING b/apex/statsd/TEST_MAPPING
deleted file mode 100644
index 331fe77..0000000
--- a/apex/statsd/TEST_MAPPING
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "presubmit" : [
- {
- "name" : "FrameworkStatsdTest"
- },
- {
- "name" : "LibStatsPullTests"
- }
- ],
-
- "postsubmit" : [
- {
- "name" : "CtsStatsdHostTestCases"
- },
- {
- "name" : "GtsStatsdHostTestCases"
- }
- ]
-}
diff --git a/apex/statsd/aidl/Android.bp b/apex/statsd/aidl/Android.bp
deleted file mode 100644
index f66cf7c..0000000
--- a/apex/statsd/aidl/Android.bp
+++ /dev/null
@@ -1,52 +0,0 @@
-//
-// 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.
-//
-filegroup {
- name: "framework-statsd-aidl-sources",
- srcs: ["**/*.aidl"],
-}
-
-aidl_interface {
- name: "statsd-aidl",
- unstable: true,
- srcs: [
- "android/os/IPendingIntentRef.aidl",
- "android/os/IPullAtomCallback.aidl",
- "android/os/IPullAtomResultReceiver.aidl",
- "android/os/IStatsCompanionService.aidl",
- "android/os/IStatsd.aidl",
- "android/os/StatsDimensionsValueParcel.aidl",
- "android/util/StatsEventParcel.aidl",
- ],
- host_supported: true,
- backend: {
- java: {
- enabled: false, // framework-statsd and service-statsd use framework-statsd-aidl-sources
- },
- cpp: {
- enabled: false,
- },
- ndk: {
- enabled: true,
- apex_available: [
- // TODO(b/145923087): Remove this once statsd binary is in apex
- "//apex_available:platform",
-
- "com.android.os.statsd",
- "test_com.android.os.statsd",
- ],
- },
- }
-}
diff --git a/apex/statsd/aidl/android/os/IPendingIntentRef.aidl b/apex/statsd/aidl/android/os/IPendingIntentRef.aidl
deleted file mode 100644
index 000a699..0000000
--- a/apex/statsd/aidl/android/os/IPendingIntentRef.aidl
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.os;
-
-import android.os.StatsDimensionsValueParcel;
-
-/**
- * Binder interface to hold a PendingIntent for StatsCompanionService.
- * {@hide}
- */
-interface IPendingIntentRef {
-
- /**
- * Sends a broadcast to the specified PendingIntent that it should getData now.
- * This should be only called from StatsCompanionService.
- */
- oneway void sendDataBroadcast(long lastReportTimeNs);
-
- /**
- * Send a broadcast to the specified PendingIntent notifying it that the list of active configs
- * has changed. This should be only called from StatsCompanionService.
- */
- oneway void sendActiveConfigsChangedBroadcast(in long[] configIds);
-
- /**
- * Send a broadcast to the specified PendingIntent, along with the other information
- * specified. This should only be called from StatsCompanionService.
- */
- oneway void sendSubscriberBroadcast(long configUid, long configId, long subscriptionId,
- long subscriptionRuleId, in String[] cookies,
- in StatsDimensionsValueParcel dimensionsValueParcel);
-}
diff --git a/apex/statsd/aidl/android/os/IPullAtomCallback.aidl b/apex/statsd/aidl/android/os/IPullAtomCallback.aidl
deleted file mode 100644
index ff0b97b..0000000
--- a/apex/statsd/aidl/android/os/IPullAtomCallback.aidl
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.os;
-
-import android.os.IPullAtomResultReceiver;
-
-/**
- * Binder interface to pull atoms for the stats service.
- * {@hide}
- */
-interface IPullAtomCallback {
- /**
- * Initiate a request for a pull for an atom.
- */
- oneway void onPullAtom(int atomTag, IPullAtomResultReceiver resultReceiver);
-
-}
diff --git a/apex/statsd/aidl/android/os/IPullAtomResultReceiver.aidl b/apex/statsd/aidl/android/os/IPullAtomResultReceiver.aidl
deleted file mode 100644
index 00d026e..0000000
--- a/apex/statsd/aidl/android/os/IPullAtomResultReceiver.aidl
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.os;
-
-import android.util.StatsEventParcel;
-
-/**
- * Binder interface to pull atoms for the stats service.
- * {@hide}
- */
-interface IPullAtomResultReceiver {
-
- /**
- * Indicate that a pull request for an atom is complete.
- */
- oneway void pullFinished(int atomTag, boolean success, in StatsEventParcel[] output);
-
-}
diff --git a/apex/statsd/aidl/android/os/IStatsCompanionService.aidl b/apex/statsd/aidl/android/os/IStatsCompanionService.aidl
deleted file mode 100644
index d56a4bd..0000000
--- a/apex/statsd/aidl/android/os/IStatsCompanionService.aidl
+++ /dev/null
@@ -1,57 +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.os;
-
-/**
- * Binder interface to communicate with the Java-based statistics service helper.
- * {@hide}
- */
-interface IStatsCompanionService {
- /**
- * Tell statscompanion that stastd is up and running.
- */
- oneway void statsdReady();
-
- /**
- * Register a repeating alarm for pulling to fire at the given timestamp and every
- * intervalMs thereafter (in ms since epoch).
- * If polling alarm had already been registered, it will be replaced by new one.
- * Uses AlarmManager.setRepeating API, so if the timestamp is in past, alarm fires immediately,
- * and alarm is inexact.
- */
- oneway void setPullingAlarm(long nextPullTimeMs);
-
- /** Cancel any repeating pulling alarm. */
- oneway void cancelPullingAlarm();
-
- /**
- * Register an alarm when we want to trigger subscribers at the given
- * timestamp (in ms since epoch).
- * If an alarm had already been registered, it will be replaced by new one.
- */
- oneway void setAlarmForSubscriberTriggering(long timestampMs);
-
- /** Cancel any alarm for the purpose of subscriber triggering. */
- oneway void cancelAlarmForSubscriberTriggering();
-
- /**
- * Ask StatsCompanionService if the given permission is allowed for a particular process
- * and user ID. statsd is incapable of doing this check itself because checkCallingPermission
- * is not currently supported by libbinder_ndk.
- */
- boolean checkPermission(String permission, int pid, int uid);
-}
diff --git a/apex/statsd/aidl/android/os/IStatsManagerService.aidl b/apex/statsd/aidl/android/os/IStatsManagerService.aidl
deleted file mode 100644
index b59a97e..0000000
--- a/apex/statsd/aidl/android/os/IStatsManagerService.aidl
+++ /dev/null
@@ -1,136 +0,0 @@
-/**
- * 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.os;
-
-import android.app.PendingIntent;
-import android.os.IPullAtomCallback;
-
-/**
- * Binder interface to communicate with the Java-based statistics service helper.
- * Contains parcelable objects available only in Java.
- * {@hide}
- */
-interface IStatsManagerService {
-
- /**
- * Registers the given pending intent for this config key. This intent is invoked when the
- * memory consumed by the metrics for this configuration approach the pre-defined limits. There
- * can be at most one listener per config key.
- *
- * Requires Manifest.permission.DUMP and Manifest.permission.PACKAGE_USAGE_STATS.
- */
- void setDataFetchOperation(long configId, in PendingIntent pendingIntent,
- in String packageName);
-
- /**
- * Removes the data fetch operation for the specified configuration.
- *
- * Requires Manifest.permission.DUMP and Manifest.permission.PACKAGE_USAGE_STATS.
- */
- void removeDataFetchOperation(long configId, in String packageName);
-
- /**
- * Registers the given pending intent for this packagename. This intent is invoked when the
- * active status of any of the configs sent by this package changes and will contain a list of
- * config ids that are currently active. It also returns the list of configs that are currently
- * active. There can be at most one active configs changed listener per package.
- *
- * Requires Manifest.permission.DUMP and Manifest.permission.PACKAGE_USAGE_STATS.
- */
- long[] setActiveConfigsChangedOperation(in PendingIntent pendingIntent, in String packageName);
-
- /**
- * Removes the active configs changed operation for the specified package name.
- *
- * Requires Manifest.permission.DUMP and Manifest.permission.PACKAGE_USAGE_STATS.
- */
- void removeActiveConfigsChangedOperation(in String packageName);
-
- /**
- * Set the PendingIntent to be used when broadcasting subscriber
- * information to the given subscriberId within the given config.
- *
- * Suppose that the calling uid has added a config with key configKey, and that in this config
- * it is specified that when a particular anomaly is detected, a broadcast should be sent to
- * a BroadcastSubscriber with id subscriberId. This function links the given pendingIntent with
- * that subscriberId (for that config), so that this pendingIntent is used to send the broadcast
- * when the anomaly is detected.
- *
- * This function can only be called by the owner (uid) of the config. It must be called each
- * time statsd starts. Later calls overwrite previous calls; only one PendingIntent is stored.
- *
- * Requires Manifest.permission.DUMP and Manifest.permission.PACKAGE_USAGE_STATS.
- */
- void setBroadcastSubscriber(long configKey, long subscriberId, in PendingIntent pendingIntent,
- in String packageName);
-
- /**
- * Undoes setBroadcastSubscriber() for the (configKey, subscriberId) pair.
- * Any broadcasts associated with subscriberId will henceforth not be sent.
- * No-op if this (configKey, subscriberId) pair was not associated with an PendingIntent.
- *
- * Requires Manifest.permission.DUMP and Manifest.permission.PACKAGE_USAGE_STATS.
- */
- void unsetBroadcastSubscriber(long configKey, long subscriberId, in String packageName);
-
- /**
- * Returns the most recently registered experiment IDs.
- *
- * Requires Manifest.permission.DUMP and Manifest.permission.PACKAGE_USAGE_STATS.
- */
- long[] getRegisteredExperimentIds();
-
- /**
- * Fetches metadata across statsd. Returns byte array representing wire-encoded proto.
- *
- * Requires Manifest.permission.DUMP and Manifest.permission.PACKAGE_USAGE_STATS.
- */
- byte[] getMetadata(in String packageName);
-
- /**
- * Fetches data for the specified configuration key. Returns a byte array representing proto
- * wire-encoded of ConfigMetricsReportList.
- *
- * Requires Manifest.permission.DUMP and Manifest.permission.PACKAGE_USAGE_STATS.
- */
- byte[] getData(in long key, in String packageName);
-
- /**
- * Sets a configuration with the specified config id and subscribes to updates for this
- * configuration id. Broadcasts will be sent if this configuration needs to be collected.
- * The configuration must be a wire-encoded StatsdConfig. The receiver for this data is
- * registered in a separate function.
- *
- * Requires Manifest.permission.DUMP and Manifest.permission.PACKAGE_USAGE_STATS.
- */
- void addConfiguration(in long configId, in byte[] config, in String packageName);
-
- /**
- * Removes the configuration with the matching config id. No-op if this config id does not
- * exist.
- *
- * Requires Manifest.permission.DUMP and Manifest.permission.PACKAGE_USAGE_STATS.
- */
- void removeConfiguration(in long configId, in String packageName);
-
- /** Tell StatsManagerService to register a puller for the given atom tag with statsd. */
- oneway void registerPullAtomCallback(int atomTag, long coolDownMillis, long timeoutMillis,
- in int[] additiveFields, IPullAtomCallback pullerCallback);
-
- /** Tell StatsManagerService to unregister the pulller for the given atom tag from statsd. */
- oneway void unregisterPullAtomCallback(int atomTag);
-}
diff --git a/apex/statsd/aidl/android/os/IStatsd.aidl b/apex/statsd/aidl/android/os/IStatsd.aidl
deleted file mode 100644
index 066412a..0000000
--- a/apex/statsd/aidl/android/os/IStatsd.aidl
+++ /dev/null
@@ -1,230 +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.os;
-
-import android.os.IPendingIntentRef;
-import android.os.IPullAtomCallback;
-import android.os.ParcelFileDescriptor;
-
-/**
- * Binder interface to communicate with the statistics management service.
- * {@hide}
- */
-interface IStatsd {
- /**
- * Tell the stats daemon that the android system server is up and running.
- */
- oneway void systemRunning();
-
- /**
- * Tell the stats daemon that the android system has finished booting.
- */
- oneway void bootCompleted();
-
- /**
- * Tell the stats daemon that the StatsCompanionService is up and running.
- * Two-way binder call so that caller knows message received.
- */
- void statsCompanionReady();
-
- /**
- * Tells statsd that it is time to poll some stats. Statsd will be responsible for determing
- * what stats to poll and initiating the polling.
- * Two-way binder call so that caller's method (and corresponding wakelocks) will linger.
- */
- void informPollAlarmFired();
-
- /**
- * Tells statsd that it is time to handle periodic alarms. Statsd will be responsible for
- * determing what alarm subscriber to trigger.
- * Two-way binder call so that caller's method (and corresponding wakelocks) will linger.
- */
- void informAlarmForSubscriberTriggeringFired();
-
- /**
- * Tells statsd that the device is about to shutdown.
- */
- void informDeviceShutdown();
-
- /**
- * Inform statsd about a file descriptor for a pipe through which we will pipe version
- * and package information for each uid.
- * Versions and package information are supplied via UidData proto where info for each app
- * is captured in its own element of a repeated ApplicationInfo message.
- */
- oneway void informAllUidData(in ParcelFileDescriptor fd);
-
- /**
- * Inform statsd what the uid, version, version_string, and installer are for one app that was
- * updated.
- */
- oneway void informOnePackage(in String app, in int uid, in long version,
- in String version_string, in String installer);
-
- /**
- * Inform stats that an app was removed.
- */
- oneway void informOnePackageRemoved(in String app, in int uid);
-
- /**
- * Fetches data for the specified configuration key. Returns a byte array representing proto
- * wire-encoded of ConfigMetricsReportList.
- *
- * Requires Manifest.permission.DUMP.
- */
- byte[] getData(in long key, int callingUid);
-
- /**
- * Fetches metadata across statsd. Returns byte array representing wire-encoded proto.
- *
- * Requires Manifest.permission.DUMP.
- */
- byte[] getMetadata();
-
- /**
- * Sets a configuration with the specified config id and subscribes to updates for this
- * configuration key. Broadcasts will be sent if this configuration needs to be collected.
- * The configuration must be a wire-encoded StatsdConfig. The receiver for this data is
- * registered in a separate function.
- *
- * Requires Manifest.permission.DUMP.
- */
- void addConfiguration(in long configId, in byte[] config, in int callingUid);
-
- /**
- * Registers the given pending intent for this config key. This intent is invoked when the
- * memory consumed by the metrics for this configuration approach the pre-defined limits. There
- * can be at most one listener per config key.
- *
- * Requires Manifest.permission.DUMP.
- */
- void setDataFetchOperation(long configId, in IPendingIntentRef pendingIntentRef,
- int callingUid);
-
- /**
- * Removes the data fetch operation for the specified configuration.
- *
- * Requires Manifest.permission.DUMP.
- */
- void removeDataFetchOperation(long configId, int callingUid);
-
- /**
- * Registers the given pending intent for this packagename. This intent is invoked when the
- * active status of any of the configs sent by this package changes and will contain a list of
- * config ids that are currently active. It also returns the list of configs that are currently
- * active. There can be at most one active configs changed listener per package.
- *
- * Requires Manifest.permission.DUMP and Manifest.permission.PACKAGE_USAGE_STATS.
- */
- long[] setActiveConfigsChangedOperation(in IPendingIntentRef pendingIntentRef, int callingUid);
-
- /**
- * Removes the active configs changed operation for the specified package name.
- *
- * Requires Manifest.permission.DUMP and Manifest.permission.PACKAGE_USAGE_STATS.
- */
- void removeActiveConfigsChangedOperation(int callingUid);
-
- /**
- * Removes the configuration with the matching config id. No-op if this config id does not
- * exist.
- *
- * Requires Manifest.permission.DUMP.
- */
- void removeConfiguration(in long configId, in int callingUid);
-
- /**
- * Set the PendingIntentRef to be used when broadcasting subscriber
- * information to the given subscriberId within the given config.
- *
- * Suppose that the calling uid has added a config with key configId, and that in this config
- * it is specified that when a particular anomaly is detected, a broadcast should be sent to
- * a BroadcastSubscriber with id subscriberId. This function links the given pendingIntent with
- * that subscriberId (for that config), so that this pendingIntent is used to send the broadcast
- * when the anomaly is detected.
- *
- * This function can only be called by the owner (uid) of the config. It must be called each
- * time statsd starts. Later calls overwrite previous calls; only one pendingIntent is stored.
- *
- * Requires Manifest.permission.DUMP.
- */
- void setBroadcastSubscriber(long configId, long subscriberId, in IPendingIntentRef pir,
- int callingUid);
-
- /**
- * Undoes setBroadcastSubscriber() for the (configId, subscriberId) pair.
- * Any broadcasts associated with subscriberId will henceforth not be sent.
- * No-op if this (configKey, subscriberId) pair was not associated with an PendingIntentRef.
- *
- * Requires Manifest.permission.DUMP.
- */
- void unsetBroadcastSubscriber(long configId, long subscriberId, int callingUid);
-
- /**
- * Tell the stats daemon that all the pullers registered during boot have been sent.
- */
- oneway void allPullersFromBootRegistered();
-
- /**
- * Registers a puller callback function that, when invoked, pulls the data
- * for the specified atom tag.
- */
- oneway void registerPullAtomCallback(int uid, int atomTag, long coolDownMillis,
- long timeoutMillis,in int[] additiveFields,
- IPullAtomCallback pullerCallback);
-
- /**
- * Registers a puller callback function that, when invoked, pulls the data
- * for the specified atom tag.
- *
- * Enforces the REGISTER_STATS_PULL_ATOM permission.
- */
- oneway void registerNativePullAtomCallback(int atomTag, long coolDownMillis, long timeoutMillis,
- in int[] additiveFields, IPullAtomCallback pullerCallback);
-
- /**
- * Unregisters any pullAtomCallback for the given uid/atom.
- */
- oneway void unregisterPullAtomCallback(int uid, int atomTag);
-
- /**
- * Unregisters any pullAtomCallback for the given atom + caller.
- *
- * Enforces the REGISTER_STATS_PULL_ATOM permission.
- */
- oneway void unregisterNativePullAtomCallback(int atomTag);
-
- /**
- * The install requires staging.
- */
- const int FLAG_REQUIRE_STAGING = 0x01;
-
- /**
- * Rollback is enabled with this install.
- */
- const int FLAG_ROLLBACK_ENABLED = 0x02;
-
- /**
- * Requires low latency monitoring.
- */
- const int FLAG_REQUIRE_LOW_LATENCY_MONITOR = 0x04;
-
- /**
- * Returns the most recently registered experiment IDs.
- */
- long[] getRegisteredExperimentIds();
-}
diff --git a/apex/statsd/aidl/android/os/StatsDimensionsValueParcel.aidl b/apex/statsd/aidl/android/os/StatsDimensionsValueParcel.aidl
deleted file mode 100644
index 05f78d0..0000000
--- a/apex/statsd/aidl/android/os/StatsDimensionsValueParcel.aidl
+++ /dev/null
@@ -1,21 +0,0 @@
-package android.os;
-
-/**
- * @hide
- */
-parcelable StatsDimensionsValueParcel {
- // Field equals atomTag for top level StatsDimensionsValueParcels or
- // positions in depth (1-indexed) for lower level parcels.
- int field;
-
- // Indicator for which type of value is stored. Should be set to one
- // of the constants in StatsDimensionsValue.java.
- int valueType;
-
- String stringValue;
- int intValue;
- long longValue;
- boolean boolValue;
- float floatValue;
- StatsDimensionsValueParcel[] tupleValue;
-}
diff --git a/apex/statsd/aidl/android/util/StatsEventParcel.aidl b/apex/statsd/aidl/android/util/StatsEventParcel.aidl
deleted file mode 100644
index add8bfb..0000000
--- a/apex/statsd/aidl/android/util/StatsEventParcel.aidl
+++ /dev/null
@@ -1,8 +0,0 @@
-package android.util;
-
-/**
- * @hide
- */
-parcelable StatsEventParcel {
- byte[] buffer;
-}
diff --git a/apex/statsd/apex_manifest.json b/apex/statsd/apex_manifest.json
deleted file mode 100644
index 1d029c6..0000000
--- a/apex/statsd/apex_manifest.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "name": "com.android.os.statsd",
- "version": 309999900
-}
-
diff --git a/apex/statsd/com.android.os.statsd.avbpubkey b/apex/statsd/com.android.os.statsd.avbpubkey
deleted file mode 100644
index d78af8b..0000000
--- a/apex/statsd/com.android.os.statsd.avbpubkey
+++ /dev/null
Binary files differ
diff --git a/apex/statsd/com.android.os.statsd.pem b/apex/statsd/com.android.os.statsd.pem
deleted file mode 100644
index 558e17f..0000000
--- a/apex/statsd/com.android.os.statsd.pem
+++ /dev/null
@@ -1,51 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIIJKgIBAAKCAgEA893bbpkivKEiNgfknYBSlzC0csaKU/ddBm5Pb4ZFuab+LQSR
-9DDc5JrsmxyrsrvuwL/zAtMbkyYWzEiUxJtx/w0bw8rC90GoPRSCmxyI0ZK8FuPy
-IAQ7UeNfTWZ485mAUaTSasGIfQ3DY4F0P+aUSijeG3NUY02nALHDMqJX7lXR+mL1
-DUYDg05KB0jxQwlYqBeujTPPiAzEqm3PlBoHuan8/qgK2wdQMTVg/fieUD3lupmV
-Wj2dRZgqfBPA16ZbV4Uo0j0bZSf+fQLiXlU2VJGb5i/FQfjLqMKGABDI0MgK7Sc2
-m4ySpV4g4XKDv/vw6Dw4kwWC7mATEVAkH+q6V7uiZeN6a7w30UMtPI8fPaUvAP3L
-VBjCBIv/3m+CKkWcNxOZ3sQBQl5bS05dxcfiVsBvBLYbvQgC+Wy0Sc3b+1pXFT/E
-uAsbZ4CyVsi1+PAdx3h5e2QAyNCXgZDOcvTUyxY6JLTE0LOVHmI4fJEujBex//Oz
-PCRHvC8K+KiljyQWf/NYrLSD3QGYAjVMtQh7yu2yhzWzgBUxyhuv3rY4ATXsN3bJ
-wW4w7/L/RSLSW5+lp/NoJOD9utbsKTyGMHOY6K8JLOmhv3ORoAEmLYlFTI+FqBi9
-AH1HQEKCyh8Z/bYHLUzGWl6FqAMtcnuintv40BbKyt0/D1ItdbSNKmOZ5rkCAwEA
-AQKCAgAY7ll8mRNADYkd1Pi+UVwgMM6B3WJO6z8LZUOhtyxxqmzZ1VnGiShMBrqh
-sPCsuSHTeswxQbvT81TpVZI/91RUKtbn0VbVSFUWyX4AtY4XPtUT0gHy2/vkh0Y6
-93ruDIdd0Wfhmh+GCV4sUhO8ZKpMWpk6XTQHYuzr2UCHcKlkqElrO6qpzLqXNe3D
-iOWBYPc7WBB0RxO0aPnCIq/SCEc55/MBZdSWR80e+sILtNsagPl3djQaoanub3wI
-a0yPv2YfMHHX7H9cfBY8WYsi8bs4MhqqEcAs2m6XtitU3mJpVcooLJYcmOZ1GYZr
-BfYKLouWcnGmNi4IiLHqVzMaQDkEhAZsRaAXCkoVVrFBedLlmLPpiUIQlINF4vxe
-3IcekTKWyMzkU6h+K8T15MU5mLSqeL2Gji1JIwKJno51FZ9uc++pUJVtfYQmNny8
-8RKvQ1hv/S5yLQKgN+VkNbaWlUoMP73dtUe3m/At71/2Dj7xB0KtcgT1lEMrM1GR
-oynJAJLz/d0n5RUUREwkZZMcA4fQVC7Db6vpK69jPiQMShpZ3JKCEjfYLUuN0slt
-FPhjiR175E0vTRuLoIj4kXNwLLswH0c9zqrKM2S92SCxAV3E4JJGKhUZalvT9s1g
-LrPhMCl6CsOES98T87d3RyAIK0iVRCnRUG3bc+8rzyRd4fzkAQKCAQEA/UjmCSm3
-H46t/1w7YBZPew7SFQOAJe81iDzbonc3fNPD2R8lxtD3MwdvrQ5f9fhT4+uveWNr
-dyBX7ppnissyM3LZRN+7BdeIVVeIPVen6Ou9W2i7q18ZoQx9IpRcZEw5tGJFZaGx
-EmyPN4i1K0ccUkGbBvbXXQ/tcG3wElRpBAc5/TQ8vrpUgHll2/MbYhowx6P9uHv5
-thoyG98X+7Fbg8ikzw5GtyuedXfyX1CpJ7yUQVS2PEaOMXOkZdx2bbWRAYYCpsqB
-dMmjs2PsFhZHu6CpLhlocHbfUiRztCUCaMZJPQXFSVmy8QDMvZEdVLvad9Poi8ny
-lmHVRgxaNbAtIQKCAQEA9nscqRaaO7hIX9bOUxcDbI0486Ws4H0hAFApIN+6/LP4
-hkxey3xWArTYWrvSG1d5GkJAdn99ayWzo2PevmJlrhIJiO1QqYBAk+87cnhwSCmB
-kb0sGkNWcc/xNRy7eqdhyCmVhaUnIbORee+cD6qiu/l2BAclTf2ZARFOGXjhQkvt
-cDbc/9ZR467ceXbiTIU34Be4xnNAY1mo59jvwl9eqxgpefYTqPhcZ7OmlDli77Hd
-XuRfuxLZCscv7A9M5Enc2zwOEP5VwRNwYzYtMm2Yh9CQZxNWC7JVh1Gw5MPFzsGl
-sgEdb4WGneN6PPLQHK7NF0f7wYSNnF0i3XSME9MumQKCAQEA0qMbWydr+TyJC0LC
-xigHtUkgAQXGPsXuePxTk4sdhBwAVcKHgg4qZi+a+gpoV4BLE9LfPU4nAwzM08to
-rI5Lk2nBsnt1Z2hVItQGoy0QoK3b7fbti5ktETf3oRhMtcSGgLLxD5ImVjId8Isq
-T3F15hpVOLdzZxtl1Qg4jKXSJ91yplYY5mzC9Yz/3qkQbsdlJcIFsLS5eG3UmkUw
-Bsr6VmA4X1F6Eb6eqwYzdHz6D+fOS36NhxcODaYkY+myO46xptixv8/NVTiTgQ5q
-OfwRb8Iur/3FUzIoioFyD7Bvjn7ITY1NArEsFS0bF9Nk1yDakKiUThyGN/Xojbac
-FuYKwQKCAQEAxOWJ+qU8phJLdowBHC0ZJiEWasRhep9auoZOpJ01IWOfV6EwZLs5
-dkYDQ1Agwoi5DDn6hu7HQM3IV/CS4mF2OnzcMw7ozc7PR53nTkVZ5LuLbuHAlmZO
-avKjDDucpJmLqjtV34IT5X8t6kt3zqgQAbuBBCy1Jz07ebfaPMzsnWpMDcU1/AW4
-OvrX0wweMOSGwzQP/i/ZMsRQAo2w0gQfeuv9Thk+kU99ebXwjx3co//hCEnFE4s1
-6L8/0AJU+VTr4hJyZi7WUDt4HzkLF+qm22/Hux+eMA/Q9R1UAxtFLCpTdAQiAJGY
-/Q3X+1I434DgAwYU3f1Gpq9cB65vq/KamQKCAQEAjIub5wde/ttHlLALvnOXrbqe
-nUIfWHExMzhul/rkr8fFEJwij2nZUuN2EWUGzBWQQoNXw5QKHLZyPsyFUOa/P2BS
-osnffAa+sumL4k36E71xFdTVV5ExyTXZVB49sPmUpivP9gEucFFqDHKjGsF45dBF
-+DZdykLUIv+/jQUzXGkZ5Wv/r52YUNho4EZdwnlJ2so7cxnsYnjW+c1nlp17tkq5
-DfwktkeD9iFzlaZ66vLoO44luaBm+lC3xM2sHinOTwbk0gvhJAIoLfkOYhpmGc8A
-4W/E1OHfVz6xqVDsMBFhRbQpHNkf8XZNqkIoqHVMTaMOJJlM+lb0+A9B8Bm/XA==
------END RSA PRIVATE KEY-----
diff --git a/apex/statsd/com.android.os.statsd.pk8 b/apex/statsd/com.android.os.statsd.pk8
deleted file mode 100644
index 49910f8..0000000
--- a/apex/statsd/com.android.os.statsd.pk8
+++ /dev/null
Binary files differ
diff --git a/apex/statsd/com.android.os.statsd.x509.pem b/apex/statsd/com.android.os.statsd.x509.pem
deleted file mode 100644
index e7b16b2..0000000
--- a/apex/statsd/com.android.os.statsd.x509.pem
+++ /dev/null
@@ -1,30 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIFDTCCAvWgAwIBAgIUCnta1LAl5fMMLLQx//4zWz9A2A8wDQYJKoZIhvcNAQEL
-BQAwFTETMBEGA1UECgwKR29vZ2xlIExMQzAgFw0xOTA4MTIyMjM5MzBaGA80NzU3
-MDcwODIyMzkzMFowFTETMBEGA1UECgwKR29vZ2xlIExMQzCCAiIwDQYJKoZIhvcN
-AQEBBQADggIPADCCAgoCggIBAOranWZ19jkXCF9WIlXv01tUUvLKMHWKV7X9Earw
-cL7/aax0pFbNJutgyBUiOszbR+0T7quZxz6jACu+6y7iaMJnvMluZsfTi+p2UvQt
-y6Ql7ZUOQ7bVluCFIW5hZ+8d9RrLmZdvX1r4YfF6HufDBkAbj+os+y6407OezJAV
-8EATpemc9gsCC4RJZpwzTs1RUXMD4UoNrLZAE8+7iaJZeBxmz0MAPj92pYc9M7/d
-xInzYvOR08/uEpHt8jlMdVgSQS/FaRlIOIqcGBk3cjkjDlpVATQ4Hyjy+IPQPjTD
-bJUmDJiYeBCyY/pYZQvTQjl8s+fvykTsF9Lfb+E+PhZ0+N8pRi7sUSpisZHSiqaN
-W3oxYWc0YQSuzygHHog8HH/azHX5L805g/+Rwfb/cUF9eJgjq0vrkFnsz4UKgKNV
-hHL90mfqpbc2UvJ8VY8BvIjbsHQ77LrBKlqI9VMPorttpTOuwHHJPKsyN972F0Ul
-lRB6CwFE8csVGWXoNaDZWBv7xTDdbdirmlKDNueg9pw6ksYV2Is9Dv8PxmsZvb+4
-oftC/hb4X1Pudn01PPs9Tx44CwHuVLENUwlDEVzG5zNetsv9kAuCYt3VRVF+NYqj
-NAfLbxCKLe25wGzJrZUEJ1YrYIjpUbfwnttEad/9Pu13DAS7HZwn5vwqEKB/1LlT
-NSUXAgMBAAGjUzBRMB0GA1UdDgQWBBSKElkhJSbzgh8+iysye8SrkmJ62DAfBgNV
-HSMEGDAWgBSKElkhJSbzgh8+iysye8SrkmJ62DAPBgNVHRMBAf8EBTADAQH/MA0G
-CSqGSIb3DQEBCwUAA4ICAQANFGnc2wJBrFbh2nzhl06g4TjPKGRCw365vZ1A3T9O
-jXP0lToHDxB33TpKk6d7zszR1uPphQQxgzhSVZB/jx8q4kWSSoKoF9Dlx7h8rAt+
-2TM5DaBvxrwu5mqOALwQuF81wap1Pl2L2fFHvygCm8b+Ci4iS5vcr0axNnp1rK1b
-vUtRWY4mfxTjJYcgeCVUGskqTb+cCxQZ6Icno6VTKajT1FybRmD3KZJaUuLbNEN+
-IE4nGTMG2WZ5Hl2vR8JJp1sYYn8T3ElMAb0MSNFkqsfI+tToEwGsuJDgYEdtEnzf
-lTycQvn5NhrIZRRN3pqSyWpAU7p9mmyTK0PHMz2D/Rtfb7lE692vXzxCmZND51mc
-YXCCoanV6eZZ7Sbqzh60+5QV38hgFBst5l8CcFaWWSFK9nBWdzS5lhs9lmQ4aiYd
-IE0qsNZgMob+TTP1VW39hu4EDjNmOrKfimM9J2tcPZ5QP01DgETPvAsB7vn2Xz9J
-HGt5ntiSV4W2izDP8viQ1M5NvfdBaUhcnNsE6/sxfU0USRs2hrEp1oiqrv4p6V0P
-qOt7C2/YtJzkrxfsHZAxBUSRHa7LwtzgeiJDUivHn94VnAzSAH8MLx6CzDPQ8HWN
-NiZFxTKfMVyjEmbQ2PalHWB8pWtpdEh7X4rzaqhnLBTis3pGssASgo3ArLIYleAU
-+g==
------END CERTIFICATE-----
diff --git a/apex/statsd/framework/Android.bp b/apex/statsd/framework/Android.bp
deleted file mode 100644
index e4299f5..0000000
--- a/apex/statsd/framework/Android.bp
+++ /dev/null
@@ -1,85 +0,0 @@
-// 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 {
- default_visibility: [ ":__pkg__" ]
-}
-
-genrule {
- name: "statslog-statsd-java-gen",
- tools: ["stats-log-api-gen"],
- cmd: "$(location stats-log-api-gen) --java $(out) --module statsd" +
- " --javaPackage com.android.internal.statsd --javaClass StatsdStatsLog",
- out: ["com/android/internal/statsd/StatsdStatsLog.java"],
-}
-
-java_library_static {
- name: "statslog-statsd",
- srcs: [
- ":statslog-statsd-java-gen",
- ],
- visibility: [
- "//cts/hostsidetests/statsd/apps:__subpackages__",
- "//vendor:__subpackages__",
- ],
-}
-
-filegroup {
- name: "framework-statsd-sources",
- srcs: [
- "java/**/*.java",
- ":framework-statsd-aidl-sources",
- ":statslog-statsd-java-gen",
- ],
- visibility: [
- "//frameworks/base", // For the "global" stubs.
- "//frameworks/base/apex/statsd:__subpackages__",
- "//packages/modules/StatsD/apex:__subpackages__",
- ],
-}
-java_sdk_library {
- name: "framework-statsd",
- defaults: ["framework-module-defaults"],
- installable: true,
-
- srcs: [
- ":framework-statsd-sources",
- ],
-
- permitted_packages: [
- "android.app",
- "android.os",
- "android.util",
- // From :statslog-statsd-java-gen
- "com.android.internal.statsd",
- ],
-
- api_packages: [
- "android.app",
- "android.os",
- "android.util",
- ],
-
- hostdex: true, // for hiddenapi check
-
- impl_library_visibility: [
- "//frameworks/base/apex/statsd/framework/test:__subpackages__",
- "//packages/modules/StatsD/apex/framework/test:__subpackages__",
- ],
-
- apex_available: [
- "com.android.os.statsd",
- "test_com.android.os.statsd",
- ],
-}
diff --git a/apex/statsd/framework/api/current.txt b/apex/statsd/framework/api/current.txt
deleted file mode 100644
index a655693..0000000
--- a/apex/statsd/framework/api/current.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-// Signature format: 2.0
-package android.util {
-
- public final class StatsLog {
- method @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public static boolean logBinaryPushStateChanged(@NonNull String, long, int, int, @NonNull long[]);
- method public static boolean logEvent(int);
- method public static boolean logStart(int);
- method public static boolean logStop(int);
- }
-
-}
-
diff --git a/apex/statsd/framework/api/module-lib-current.txt b/apex/statsd/framework/api/module-lib-current.txt
deleted file mode 100644
index 8b6e217..0000000
--- a/apex/statsd/framework/api/module-lib-current.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-// Signature format: 2.0
-package android.os {
-
- public class StatsFrameworkInitializer {
- method public static void registerServiceWrappers();
- method public static void setStatsServiceManager(@NonNull android.os.StatsServiceManager);
- }
-
-}
-
diff --git a/apex/statsd/framework/api/module-lib-removed.txt b/apex/statsd/framework/api/module-lib-removed.txt
deleted file mode 100644
index d802177..0000000
--- a/apex/statsd/framework/api/module-lib-removed.txt
+++ /dev/null
@@ -1 +0,0 @@
-// Signature format: 2.0
diff --git a/apex/statsd/framework/api/removed.txt b/apex/statsd/framework/api/removed.txt
deleted file mode 100644
index d802177..0000000
--- a/apex/statsd/framework/api/removed.txt
+++ /dev/null
@@ -1 +0,0 @@
-// Signature format: 2.0
diff --git a/apex/statsd/framework/api/system-current.txt b/apex/statsd/framework/api/system-current.txt
deleted file mode 100644
index 3ea5724..0000000
--- a/apex/statsd/framework/api/system-current.txt
+++ /dev/null
@@ -1,111 +0,0 @@
-// Signature format: 2.0
-package android.app {
-
- public final class StatsManager {
- method @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public void addConfig(long, byte[]) throws android.app.StatsManager.StatsUnavailableException;
- method @Deprecated @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public boolean addConfiguration(long, byte[]);
- method @RequiresPermission(android.Manifest.permission.REGISTER_STATS_PULL_ATOM) public void clearPullAtomCallback(int);
- method @Deprecated @Nullable @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public byte[] getData(long);
- method @Deprecated @Nullable @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public byte[] getMetadata();
- method @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public long[] getRegisteredExperimentIds() throws android.app.StatsManager.StatsUnavailableException;
- method @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public byte[] getReports(long) throws android.app.StatsManager.StatsUnavailableException;
- method @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public byte[] getStatsMetadata() throws android.app.StatsManager.StatsUnavailableException;
- method @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public void removeConfig(long) throws android.app.StatsManager.StatsUnavailableException;
- method @Deprecated @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public boolean removeConfiguration(long);
- method @NonNull @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public long[] setActiveConfigsChangedOperation(@Nullable android.app.PendingIntent) throws android.app.StatsManager.StatsUnavailableException;
- method @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public void setBroadcastSubscriber(android.app.PendingIntent, long, long) throws android.app.StatsManager.StatsUnavailableException;
- method @Deprecated @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public boolean setBroadcastSubscriber(long, long, android.app.PendingIntent);
- method @Deprecated @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public boolean setDataFetchOperation(long, android.app.PendingIntent);
- method @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public void setFetchReportsOperation(android.app.PendingIntent, long) throws android.app.StatsManager.StatsUnavailableException;
- method @RequiresPermission(android.Manifest.permission.REGISTER_STATS_PULL_ATOM) public void setPullAtomCallback(int, @Nullable android.app.StatsManager.PullAtomMetadata, @NonNull java.util.concurrent.Executor, @NonNull android.app.StatsManager.StatsPullAtomCallback);
- field public static final String ACTION_STATSD_STARTED = "android.app.action.STATSD_STARTED";
- field public static final String EXTRA_STATS_ACTIVE_CONFIG_KEYS = "android.app.extra.STATS_ACTIVE_CONFIG_KEYS";
- field public static final String EXTRA_STATS_BROADCAST_SUBSCRIBER_COOKIES = "android.app.extra.STATS_BROADCAST_SUBSCRIBER_COOKIES";
- field public static final String EXTRA_STATS_CONFIG_KEY = "android.app.extra.STATS_CONFIG_KEY";
- field public static final String EXTRA_STATS_CONFIG_UID = "android.app.extra.STATS_CONFIG_UID";
- field public static final String EXTRA_STATS_DIMENSIONS_VALUE = "android.app.extra.STATS_DIMENSIONS_VALUE";
- field public static final String EXTRA_STATS_SUBSCRIPTION_ID = "android.app.extra.STATS_SUBSCRIPTION_ID";
- field public static final String EXTRA_STATS_SUBSCRIPTION_RULE_ID = "android.app.extra.STATS_SUBSCRIPTION_RULE_ID";
- field public static final int PULL_SKIP = 1; // 0x1
- field public static final int PULL_SUCCESS = 0; // 0x0
- }
-
- public static class StatsManager.PullAtomMetadata {
- method @Nullable public int[] getAdditiveFields();
- method public long getCoolDownMillis();
- method public long getTimeoutMillis();
- }
-
- public static class StatsManager.PullAtomMetadata.Builder {
- ctor public StatsManager.PullAtomMetadata.Builder();
- method @NonNull public android.app.StatsManager.PullAtomMetadata build();
- method @NonNull public android.app.StatsManager.PullAtomMetadata.Builder setAdditiveFields(@NonNull int[]);
- method @NonNull public android.app.StatsManager.PullAtomMetadata.Builder setCoolDownMillis(long);
- method @NonNull public android.app.StatsManager.PullAtomMetadata.Builder setTimeoutMillis(long);
- }
-
- public static interface StatsManager.StatsPullAtomCallback {
- method public int onPullAtom(int, @NonNull java.util.List<android.util.StatsEvent>);
- }
-
- public static class StatsManager.StatsUnavailableException extends android.util.AndroidException {
- ctor public StatsManager.StatsUnavailableException(String);
- ctor public StatsManager.StatsUnavailableException(String, Throwable);
- }
-
-}
-
-package android.os {
-
- public final class StatsDimensionsValue implements android.os.Parcelable {
- method public int describeContents();
- method public boolean getBooleanValue();
- method public int getField();
- method public float getFloatValue();
- method public int getIntValue();
- method public long getLongValue();
- method public String getStringValue();
- method public java.util.List<android.os.StatsDimensionsValue> getTupleValueList();
- method public int getValueType();
- method public boolean isValueType(int);
- method public void writeToParcel(android.os.Parcel, int);
- field public static final int BOOLEAN_VALUE_TYPE = 5; // 0x5
- field @NonNull public static final android.os.Parcelable.Creator<android.os.StatsDimensionsValue> CREATOR;
- field public static final int FLOAT_VALUE_TYPE = 6; // 0x6
- field public static final int INT_VALUE_TYPE = 3; // 0x3
- field public static final int LONG_VALUE_TYPE = 4; // 0x4
- field public static final int STRING_VALUE_TYPE = 2; // 0x2
- field public static final int TUPLE_VALUE_TYPE = 7; // 0x7
- }
-
-}
-
-package android.util {
-
- public final class StatsEvent {
- method @NonNull public static android.util.StatsEvent.Builder newBuilder();
- }
-
- public static final class StatsEvent.Builder {
- method @NonNull public android.util.StatsEvent.Builder addBooleanAnnotation(byte, boolean);
- method @NonNull public android.util.StatsEvent.Builder addIntAnnotation(byte, int);
- method @NonNull public android.util.StatsEvent build();
- method @NonNull public android.util.StatsEvent.Builder setAtomId(int);
- method @NonNull public android.util.StatsEvent.Builder usePooledBuffer();
- method @NonNull public android.util.StatsEvent.Builder writeAttributionChain(@NonNull int[], @NonNull String[]);
- method @NonNull public android.util.StatsEvent.Builder writeBoolean(boolean);
- method @NonNull public android.util.StatsEvent.Builder writeByteArray(@NonNull byte[]);
- method @NonNull public android.util.StatsEvent.Builder writeFloat(float);
- method @NonNull public android.util.StatsEvent.Builder writeInt(int);
- method @NonNull public android.util.StatsEvent.Builder writeKeyValuePairs(@Nullable android.util.SparseIntArray, @Nullable android.util.SparseLongArray, @Nullable android.util.SparseArray<java.lang.String>, @Nullable android.util.SparseArray<java.lang.Float>);
- method @NonNull public android.util.StatsEvent.Builder writeLong(long);
- method @NonNull public android.util.StatsEvent.Builder writeString(@NonNull String);
- }
-
- public final class StatsLog {
- method public static void write(@NonNull android.util.StatsEvent);
- method public static void writeRaw(@NonNull byte[], int);
- }
-
-}
-
diff --git a/apex/statsd/framework/api/system-removed.txt b/apex/statsd/framework/api/system-removed.txt
deleted file mode 100644
index d802177..0000000
--- a/apex/statsd/framework/api/system-removed.txt
+++ /dev/null
@@ -1 +0,0 @@
-// Signature format: 2.0
diff --git a/apex/statsd/framework/java/android/app/StatsManager.java b/apex/statsd/framework/java/android/app/StatsManager.java
deleted file mode 100644
index 41803cf..0000000
--- a/apex/statsd/framework/java/android/app/StatsManager.java
+++ /dev/null
@@ -1,725 +0,0 @@
-/*
- * Copyright 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.app;
-
-import static android.Manifest.permission.DUMP;
-import static android.Manifest.permission.PACKAGE_USAGE_STATS;
-
-import android.annotation.CallbackExecutor;
-import android.annotation.NonNull;
-import android.annotation.Nullable;
-import android.annotation.RequiresPermission;
-import android.annotation.SystemApi;
-import android.content.Context;
-import android.os.Binder;
-import android.os.IPullAtomCallback;
-import android.os.IPullAtomResultReceiver;
-import android.os.IStatsManagerService;
-import android.os.RemoteException;
-import android.os.StatsFrameworkInitializer;
-import android.util.AndroidException;
-import android.util.Log;
-import android.util.StatsEvent;
-import android.util.StatsEventParcel;
-
-import com.android.internal.annotations.GuardedBy;
-import com.android.internal.annotations.VisibleForTesting;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.Executor;
-
-/**
- * API for statsd clients to send configurations and retrieve data.
- *
- * @hide
- */
-@SystemApi
-public final class StatsManager {
- private static final String TAG = "StatsManager";
- private static final boolean DEBUG = false;
-
- private static final Object sLock = new Object();
- private final Context mContext;
-
- @GuardedBy("sLock")
- private IStatsManagerService mStatsManagerService;
-
- /**
- * Long extra of uid that added the relevant stats config.
- */
- public static final String EXTRA_STATS_CONFIG_UID = "android.app.extra.STATS_CONFIG_UID";
- /**
- * Long extra of the relevant stats config's configKey.
- */
- public static final String EXTRA_STATS_CONFIG_KEY = "android.app.extra.STATS_CONFIG_KEY";
- /**
- * Long extra of the relevant statsd_config.proto's Subscription.id.
- */
- public static final String EXTRA_STATS_SUBSCRIPTION_ID =
- "android.app.extra.STATS_SUBSCRIPTION_ID";
- /**
- * Long extra of the relevant statsd_config.proto's Subscription.rule_id.
- */
- public static final String EXTRA_STATS_SUBSCRIPTION_RULE_ID =
- "android.app.extra.STATS_SUBSCRIPTION_RULE_ID";
- /**
- * List<String> of the relevant statsd_config.proto's BroadcastSubscriberDetails.cookie.
- * Obtain using {@link android.content.Intent#getStringArrayListExtra(String)}.
- */
- public static final String EXTRA_STATS_BROADCAST_SUBSCRIBER_COOKIES =
- "android.app.extra.STATS_BROADCAST_SUBSCRIBER_COOKIES";
- /**
- * Extra of a {@link android.os.StatsDimensionsValue} representing sliced dimension value
- * information.
- */
- public static final String EXTRA_STATS_DIMENSIONS_VALUE =
- "android.app.extra.STATS_DIMENSIONS_VALUE";
- /**
- * Long array extra of the active configs for the uid that added those configs.
- */
- public static final String EXTRA_STATS_ACTIVE_CONFIG_KEYS =
- "android.app.extra.STATS_ACTIVE_CONFIG_KEYS";
-
- /**
- * Broadcast Action: Statsd has started.
- * Configurations and PendingIntents can now be sent to it.
- */
- public static final String ACTION_STATSD_STARTED = "android.app.action.STATSD_STARTED";
-
- // Pull atom callback return codes.
- /**
- * Value indicating that this pull was successful and that the result should be used.
- *
- **/
- public static final int PULL_SUCCESS = 0;
-
- /**
- * Value indicating that this pull was unsuccessful and that the result should not be used.
- **/
- public static final int PULL_SKIP = 1;
-
- /**
- * @hide
- **/
- @VisibleForTesting public static final long DEFAULT_COOL_DOWN_MILLIS = 1_000L; // 1 second.
-
- /**
- * @hide
- **/
- @VisibleForTesting public static final long DEFAULT_TIMEOUT_MILLIS = 2_000L; // 2 seconds.
-
- /**
- * Constructor for StatsManagerClient.
- *
- * @hide
- */
- public StatsManager(Context context) {
- mContext = context;
- }
-
- /**
- * Adds the given configuration and associates it with the given configKey. If a config with the
- * given configKey already exists for the caller's uid, it is replaced with the new one.
- *
- * @param configKey An arbitrary integer that allows clients to track the configuration.
- * @param config Wire-encoded StatsdConfig proto that specifies metrics (and all
- * dependencies eg, conditions and matchers).
- * @throws StatsUnavailableException if unsuccessful due to failing to connect to stats service
- * @throws IllegalArgumentException if config is not a wire-encoded StatsdConfig proto
- */
- @RequiresPermission(allOf = { DUMP, PACKAGE_USAGE_STATS })
- public void addConfig(long configKey, byte[] config) throws StatsUnavailableException {
- synchronized (sLock) {
- try {
- IStatsManagerService service = getIStatsManagerServiceLocked();
- // can throw IllegalArgumentException
- service.addConfiguration(configKey, config, mContext.getOpPackageName());
- } catch (RemoteException e) {
- Log.e(TAG, "Failed to connect to statsmanager when adding configuration");
- throw new StatsUnavailableException("could not connect", e);
- } catch (SecurityException e) {
- throw new StatsUnavailableException(e.getMessage(), e);
- } catch (IllegalStateException e) {
- Log.e(TAG, "Failed to addConfig in statsmanager");
- throw new StatsUnavailableException(e.getMessage(), e);
- }
- }
- }
-
- // TODO: Temporary for backwards compatibility. Remove.
- /**
- * @deprecated Use {@link #addConfig(long, byte[])}
- */
- @Deprecated
- @RequiresPermission(allOf = { DUMP, PACKAGE_USAGE_STATS })
- public boolean addConfiguration(long configKey, byte[] config) {
- try {
- addConfig(configKey, config);
- return true;
- } catch (StatsUnavailableException | IllegalArgumentException e) {
- return false;
- }
- }
-
- /**
- * Remove a configuration from logging.
- *
- * @param configKey Configuration key to remove.
- * @throws StatsUnavailableException if unsuccessful due to failing to connect to stats service
- */
- @RequiresPermission(allOf = { DUMP, PACKAGE_USAGE_STATS })
- public void removeConfig(long configKey) throws StatsUnavailableException {
- synchronized (sLock) {
- try {
- IStatsManagerService service = getIStatsManagerServiceLocked();
- service.removeConfiguration(configKey, mContext.getOpPackageName());
- } catch (RemoteException e) {
- Log.e(TAG, "Failed to connect to statsmanager when removing configuration");
- throw new StatsUnavailableException("could not connect", e);
- } catch (SecurityException e) {
- throw new StatsUnavailableException(e.getMessage(), e);
- } catch (IllegalStateException e) {
- Log.e(TAG, "Failed to removeConfig in statsmanager");
- throw new StatsUnavailableException(e.getMessage(), e);
- }
- }
- }
-
- // TODO: Temporary for backwards compatibility. Remove.
- /**
- * @deprecated Use {@link #removeConfig(long)}
- */
- @Deprecated
- @RequiresPermission(allOf = { DUMP, PACKAGE_USAGE_STATS })
- public boolean removeConfiguration(long configKey) {
- try {
- removeConfig(configKey);
- return true;
- } catch (StatsUnavailableException e) {
- return false;
- }
- }
-
- /**
- * Set the PendingIntent to be used when broadcasting subscriber information to the given
- * subscriberId within the given config.
- * <p>
- * Suppose that the calling uid has added a config with key configKey, and that in this config
- * it is specified that when a particular anomaly is detected, a broadcast should be sent to
- * a BroadcastSubscriber with id subscriberId. This function links the given pendingIntent with
- * that subscriberId (for that config), so that this pendingIntent is used to send the broadcast
- * when the anomaly is detected.
- * <p>
- * When statsd sends the broadcast, the PendingIntent will used to send an intent with
- * information of
- * {@link #EXTRA_STATS_CONFIG_UID},
- * {@link #EXTRA_STATS_CONFIG_KEY},
- * {@link #EXTRA_STATS_SUBSCRIPTION_ID},
- * {@link #EXTRA_STATS_SUBSCRIPTION_RULE_ID},
- * {@link #EXTRA_STATS_BROADCAST_SUBSCRIBER_COOKIES}, and
- * {@link #EXTRA_STATS_DIMENSIONS_VALUE}.
- * <p>
- * This function can only be called by the owner (uid) of the config. It must be called each
- * time statsd starts. The config must have been added first (via {@link #addConfig}).
- *
- * @param pendingIntent the PendingIntent to use when broadcasting info to the subscriber
- * associated with the given subscriberId. May be null, in which case
- * it undoes any previous setting of this subscriberId.
- * @param configKey The integer naming the config to which this subscriber is attached.
- * @param subscriberId ID of the subscriber, as used in the config.
- * @throws StatsUnavailableException if unsuccessful due to failing to connect to stats service
- */
- @RequiresPermission(allOf = { DUMP, PACKAGE_USAGE_STATS })
- public void setBroadcastSubscriber(
- PendingIntent pendingIntent, long configKey, long subscriberId)
- throws StatsUnavailableException {
- synchronized (sLock) {
- try {
- IStatsManagerService service = getIStatsManagerServiceLocked();
- if (pendingIntent != null) {
- service.setBroadcastSubscriber(configKey, subscriberId, pendingIntent,
- mContext.getOpPackageName());
- } else {
- service.unsetBroadcastSubscriber(configKey, subscriberId,
- mContext.getOpPackageName());
- }
- } catch (RemoteException e) {
- Log.e(TAG, "Failed to connect to statsmanager when adding broadcast subscriber",
- e);
- throw new StatsUnavailableException("could not connect", e);
- } catch (SecurityException e) {
- throw new StatsUnavailableException(e.getMessage(), e);
- }
- }
- }
-
- // TODO: Temporary for backwards compatibility. Remove.
- /**
- * @deprecated Use {@link #setBroadcastSubscriber(PendingIntent, long, long)}
- */
- @Deprecated
- @RequiresPermission(allOf = { DUMP, PACKAGE_USAGE_STATS })
- public boolean setBroadcastSubscriber(
- long configKey, long subscriberId, PendingIntent pendingIntent) {
- try {
- setBroadcastSubscriber(pendingIntent, configKey, subscriberId);
- return true;
- } catch (StatsUnavailableException e) {
- return false;
- }
- }
-
- /**
- * Registers the operation that is called to retrieve the metrics data. This must be called
- * each time statsd starts. The config must have been added first (via {@link #addConfig},
- * although addConfig could have been called on a previous boot). This operation allows
- * statsd to send metrics data whenever statsd determines that the metrics in memory are
- * approaching the memory limits. The fetch operation should call {@link #getReports} to fetch
- * the data, which also deletes the retrieved metrics from statsd's memory.
- *
- * @param pendingIntent the PendingIntent to use when broadcasting info to the subscriber
- * associated with the given subscriberId. May be null, in which case
- * it removes any associated pending intent with this configKey.
- * @param configKey The integer naming the config to which this operation is attached.
- * @throws StatsUnavailableException if unsuccessful due to failing to connect to stats service
- */
- @RequiresPermission(allOf = { DUMP, PACKAGE_USAGE_STATS })
- public void setFetchReportsOperation(PendingIntent pendingIntent, long configKey)
- throws StatsUnavailableException {
- synchronized (sLock) {
- try {
- IStatsManagerService service = getIStatsManagerServiceLocked();
- if (pendingIntent == null) {
- service.removeDataFetchOperation(configKey, mContext.getOpPackageName());
- } else {
- service.setDataFetchOperation(configKey, pendingIntent,
- mContext.getOpPackageName());
- }
-
- } catch (RemoteException e) {
- Log.e(TAG, "Failed to connect to statsmanager when registering data listener.");
- throw new StatsUnavailableException("could not connect", e);
- } catch (SecurityException e) {
- throw new StatsUnavailableException(e.getMessage(), e);
- }
- }
- }
-
- /**
- * Registers the operation that is called whenever there is a change in which configs are
- * active. This must be called each time statsd starts. This operation allows
- * statsd to inform clients that they should pull data of the configs that are currently
- * active. The activeConfigsChangedOperation should set periodic alarms to pull data of configs
- * that are active and stop pulling data of configs that are no longer active.
- *
- * @param pendingIntent the PendingIntent to use when broadcasting info to the subscriber
- * associated with the given subscriberId. May be null, in which case
- * it removes any associated pending intent for this client.
- * @return A list of configs that are currently active for this client. If the pendingIntent is
- * null, this will be an empty list.
- * @throws StatsUnavailableException if unsuccessful due to failing to connect to stats service
- */
- @RequiresPermission(allOf = { DUMP, PACKAGE_USAGE_STATS })
- public @NonNull long[] setActiveConfigsChangedOperation(@Nullable PendingIntent pendingIntent)
- throws StatsUnavailableException {
- synchronized (sLock) {
- try {
- IStatsManagerService service = getIStatsManagerServiceLocked();
- if (pendingIntent == null) {
- service.removeActiveConfigsChangedOperation(mContext.getOpPackageName());
- return new long[0];
- } else {
- return service.setActiveConfigsChangedOperation(pendingIntent,
- mContext.getOpPackageName());
- }
-
- } catch (RemoteException e) {
- Log.e(TAG, "Failed to connect to statsmanager "
- + "when registering active configs listener.");
- throw new StatsUnavailableException("could not connect", e);
- } catch (SecurityException e) {
- throw new StatsUnavailableException(e.getMessage(), e);
- }
- }
- }
-
- // TODO: Temporary for backwards compatibility. Remove.
- /**
- * @deprecated Use {@link #setFetchReportsOperation(PendingIntent, long)}
- */
- @Deprecated
- @RequiresPermission(allOf = { DUMP, PACKAGE_USAGE_STATS })
- public boolean setDataFetchOperation(long configKey, PendingIntent pendingIntent) {
- try {
- setFetchReportsOperation(pendingIntent, configKey);
- return true;
- } catch (StatsUnavailableException e) {
- return false;
- }
- }
-
- /**
- * Request the data collected for the given configKey.
- * This getter is destructive - it also clears the retrieved metrics from statsd's memory.
- *
- * @param configKey Configuration key to retrieve data from.
- * @return Serialized ConfigMetricsReportList proto.
- * @throws StatsUnavailableException if unsuccessful due to failing to connect to stats service
- */
- @RequiresPermission(allOf = { DUMP, PACKAGE_USAGE_STATS })
- public byte[] getReports(long configKey) throws StatsUnavailableException {
- synchronized (sLock) {
- try {
- IStatsManagerService service = getIStatsManagerServiceLocked();
- return service.getData(configKey, mContext.getOpPackageName());
- } catch (RemoteException e) {
- Log.e(TAG, "Failed to connect to statsmanager when getting data");
- throw new StatsUnavailableException("could not connect", e);
- } catch (SecurityException e) {
- throw new StatsUnavailableException(e.getMessage(), e);
- } catch (IllegalStateException e) {
- Log.e(TAG, "Failed to getReports in statsmanager");
- throw new StatsUnavailableException(e.getMessage(), e);
- }
- }
- }
-
- // TODO: Temporary for backwards compatibility. Remove.
- /**
- * @deprecated Use {@link #getReports(long)}
- */
- @Deprecated
- @RequiresPermission(allOf = { DUMP, PACKAGE_USAGE_STATS })
- public @Nullable byte[] getData(long configKey) {
- try {
- return getReports(configKey);
- } catch (StatsUnavailableException e) {
- return null;
- }
- }
-
- /**
- * Clients can request metadata for statsd. Will contain stats across all configurations but not
- * the actual metrics themselves (metrics must be collected via {@link #getReports(long)}.
- * This getter is not destructive and will not reset any metrics/counters.
- *
- * @return Serialized StatsdStatsReport proto.
- * @throws StatsUnavailableException if unsuccessful due to failing to connect to stats service
- */
- @RequiresPermission(allOf = { DUMP, PACKAGE_USAGE_STATS })
- public byte[] getStatsMetadata() throws StatsUnavailableException {
- synchronized (sLock) {
- try {
- IStatsManagerService service = getIStatsManagerServiceLocked();
- return service.getMetadata(mContext.getOpPackageName());
- } catch (RemoteException e) {
- Log.e(TAG, "Failed to connect to statsmanager when getting metadata");
- throw new StatsUnavailableException("could not connect", e);
- } catch (SecurityException e) {
- throw new StatsUnavailableException(e.getMessage(), e);
- } catch (IllegalStateException e) {
- Log.e(TAG, "Failed to getStatsMetadata in statsmanager");
- throw new StatsUnavailableException(e.getMessage(), e);
- }
- }
- }
-
- // TODO: Temporary for backwards compatibility. Remove.
- /**
- * @deprecated Use {@link #getStatsMetadata()}
- */
- @Deprecated
- @RequiresPermission(allOf = { DUMP, PACKAGE_USAGE_STATS })
- public @Nullable byte[] getMetadata() {
- try {
- return getStatsMetadata();
- } catch (StatsUnavailableException e) {
- return null;
- }
- }
-
- /**
- * Returns the experiments IDs registered with statsd, or an empty array if there aren't any.
- *
- * @throws StatsUnavailableException if unsuccessful due to failing to connect to stats service
- */
- @RequiresPermission(allOf = {DUMP, PACKAGE_USAGE_STATS})
- public long[] getRegisteredExperimentIds()
- throws StatsUnavailableException {
- synchronized (sLock) {
- try {
- IStatsManagerService service = getIStatsManagerServiceLocked();
- return service.getRegisteredExperimentIds();
- } catch (RemoteException e) {
- if (DEBUG) {
- Log.d(TAG,
- "Failed to connect to StatsManagerService when getting "
- + "registered experiment IDs");
- }
- throw new StatsUnavailableException("could not connect", e);
- } catch (IllegalStateException e) {
- Log.e(TAG, "Failed to getRegisteredExperimentIds in statsmanager");
- throw new StatsUnavailableException(e.getMessage(), e);
- }
- }
- }
-
- /**
- * Sets a callback for an atom when that atom is to be pulled. The stats service will
- * invoke pullData in the callback when the stats service determines that this atom needs to be
- * pulled. This method should not be called by third-party apps.
- *
- * @param atomTag The tag of the atom for this puller callback.
- * @param metadata Optional metadata specifying the timeout, cool down time, and
- * additive fields for mapping isolated to host uids.
- * @param executor The executor in which to run the callback.
- * @param callback The callback to be invoked when the stats service pulls the atom.
- *
- */
- @RequiresPermission(android.Manifest.permission.REGISTER_STATS_PULL_ATOM)
- public void setPullAtomCallback(int atomTag, @Nullable PullAtomMetadata metadata,
- @NonNull @CallbackExecutor Executor executor,
- @NonNull StatsPullAtomCallback callback) {
- long coolDownMillis =
- metadata == null ? DEFAULT_COOL_DOWN_MILLIS : metadata.mCoolDownMillis;
- long timeoutMillis = metadata == null ? DEFAULT_TIMEOUT_MILLIS : metadata.mTimeoutMillis;
- int[] additiveFields = metadata == null ? new int[0] : metadata.mAdditiveFields;
- if (additiveFields == null) {
- additiveFields = new int[0];
- }
-
- synchronized (sLock) {
- try {
- IStatsManagerService service = getIStatsManagerServiceLocked();
- PullAtomCallbackInternal rec =
- new PullAtomCallbackInternal(atomTag, callback, executor);
- service.registerPullAtomCallback(
- atomTag, coolDownMillis, timeoutMillis, additiveFields, rec);
- } catch (RemoteException e) {
- throw new RuntimeException("Unable to register pull callback", e);
- }
- }
- }
-
- /**
- * Clears a callback for an atom when that atom is to be pulled. Note that any ongoing
- * pulls will still occur. This method should not be called by third-party apps.
- *
- * @param atomTag The tag of the atom of which to unregister
- *
- */
- @RequiresPermission(android.Manifest.permission.REGISTER_STATS_PULL_ATOM)
- public void clearPullAtomCallback(int atomTag) {
- synchronized (sLock) {
- try {
- IStatsManagerService service = getIStatsManagerServiceLocked();
- service.unregisterPullAtomCallback(atomTag);
- } catch (RemoteException e) {
- throw new RuntimeException("Unable to unregister pull atom callback");
- }
- }
- }
-
- private static class PullAtomCallbackInternal extends IPullAtomCallback.Stub {
- public final int mAtomId;
- public final StatsPullAtomCallback mCallback;
- public final Executor mExecutor;
-
- PullAtomCallbackInternal(int atomId, StatsPullAtomCallback callback, Executor executor) {
- mAtomId = atomId;
- mCallback = callback;
- mExecutor = executor;
- }
-
- @Override
- public void onPullAtom(int atomTag, IPullAtomResultReceiver resultReceiver) {
- final long token = Binder.clearCallingIdentity();
- try {
- mExecutor.execute(() -> {
- List<StatsEvent> data = new ArrayList<>();
- int successInt = mCallback.onPullAtom(atomTag, data);
- boolean success = successInt == PULL_SUCCESS;
- StatsEventParcel[] parcels = new StatsEventParcel[data.size()];
- for (int i = 0; i < data.size(); i++) {
- parcels[i] = new StatsEventParcel();
- parcels[i].buffer = data.get(i).getBytes();
- }
- try {
- resultReceiver.pullFinished(atomTag, success, parcels);
- } catch (RemoteException e) {
- Log.w(TAG, "StatsPullResultReceiver failed for tag " + mAtomId
- + " due to TransactionTooLarge. Calling pullFinish with no data");
- StatsEventParcel[] emptyData = new StatsEventParcel[0];
- try {
- resultReceiver.pullFinished(atomTag, /*success=*/false, emptyData);
- } catch (RemoteException nestedException) {
- Log.w(TAG, "StatsPullResultReceiver failed for tag " + mAtomId
- + " with empty payload");
- }
- }
- });
- } finally {
- Binder.restoreCallingIdentity(token);
- }
- }
- }
-
- /**
- * Metadata required for registering a StatsPullAtomCallback.
- * All fields are optional, and defaults will be used for fields that are unspecified.
- *
- */
- public static class PullAtomMetadata {
- private final long mCoolDownMillis;
- private final long mTimeoutMillis;
- private final int[] mAdditiveFields;
-
- // Private Constructor for builder
- private PullAtomMetadata(long coolDownMillis, long timeoutMillis, int[] additiveFields) {
- mCoolDownMillis = coolDownMillis;
- mTimeoutMillis = timeoutMillis;
- mAdditiveFields = additiveFields;
- }
-
- /**
- * Builder for PullAtomMetadata.
- */
- public static class Builder {
- private long mCoolDownMillis;
- private long mTimeoutMillis;
- private int[] mAdditiveFields;
-
- /**
- * Returns a new PullAtomMetadata.Builder object for constructing PullAtomMetadata for
- * StatsManager#registerPullAtomCallback
- */
- public Builder() {
- mCoolDownMillis = DEFAULT_COOL_DOWN_MILLIS;
- mTimeoutMillis = DEFAULT_TIMEOUT_MILLIS;
- mAdditiveFields = null;
- }
-
- /**
- * Set the cool down time of the pull in milliseconds. If two successive pulls are
- * issued within the cool down, a cached version of the first pull will be used for the
- * second pull. The minimum allowed cool down is 1 second.
- */
- @NonNull
- public Builder setCoolDownMillis(long coolDownMillis) {
- mCoolDownMillis = coolDownMillis;
- return this;
- }
-
- /**
- * Set the maximum time the pull can take in milliseconds. The maximum allowed timeout
- * is 10 seconds.
- */
- @NonNull
- public Builder setTimeoutMillis(long timeoutMillis) {
- mTimeoutMillis = timeoutMillis;
- return this;
- }
-
- /**
- * Set the additive fields of this pulled atom.
- *
- * This is only applicable for atoms which have a uid field. When tasks are run in
- * isolated processes, the data will be attributed to the host uid. Additive fields
- * will be combined when the non-additive fields are the same.
- */
- @NonNull
- public Builder setAdditiveFields(@NonNull int[] additiveFields) {
- mAdditiveFields = additiveFields;
- return this;
- }
-
- /**
- * Builds and returns a PullAtomMetadata object with the values set in the builder and
- * defaults for unset fields.
- */
- @NonNull
- public PullAtomMetadata build() {
- return new PullAtomMetadata(mCoolDownMillis, mTimeoutMillis, mAdditiveFields);
- }
- }
-
- /**
- * Return the cool down time of this pull in milliseconds.
- */
- public long getCoolDownMillis() {
- return mCoolDownMillis;
- }
-
- /**
- * Return the maximum amount of time this pull can take in milliseconds.
- */
- public long getTimeoutMillis() {
- return mTimeoutMillis;
- }
-
- /**
- * Return the additive fields of this pulled atom.
- *
- * This is only applicable for atoms that have a uid field. When tasks are run in
- * isolated processes, the data will be attributed to the host uid. Additive fields
- * will be combined when the non-additive fields are the same.
- */
- @Nullable
- public int[] getAdditiveFields() {
- return mAdditiveFields;
- }
- }
-
- /**
- * Callback interface for pulling atoms requested by the stats service.
- *
- */
- public interface StatsPullAtomCallback {
- /**
- * Pull data for the specified atom tag, filling in the provided list of StatsEvent data.
- * @return {@link #PULL_SUCCESS} if the pull was successful, or {@link #PULL_SKIP} if not.
- */
- int onPullAtom(int atomTag, @NonNull List<StatsEvent> data);
- }
-
- @GuardedBy("sLock")
- private IStatsManagerService getIStatsManagerServiceLocked() {
- if (mStatsManagerService != null) {
- return mStatsManagerService;
- }
- mStatsManagerService = IStatsManagerService.Stub.asInterface(
- StatsFrameworkInitializer
- .getStatsServiceManager()
- .getStatsManagerServiceRegisterer()
- .get());
- return mStatsManagerService;
- }
-
- /**
- * Exception thrown when communication with the stats service fails (eg if it is not available).
- * This might be thrown early during boot before the stats service has started or if it crashed.
- */
- public static class StatsUnavailableException extends AndroidException {
- public StatsUnavailableException(String reason) {
- super("Failed to connect to statsd: " + reason);
- }
-
- public StatsUnavailableException(String reason, Throwable e) {
- super("Failed to connect to statsd: " + reason, e);
- }
- }
-}
diff --git a/apex/statsd/framework/java/android/os/StatsDimensionsValue.java b/apex/statsd/framework/java/android/os/StatsDimensionsValue.java
deleted file mode 100644
index 7d9349c..0000000
--- a/apex/statsd/framework/java/android/os/StatsDimensionsValue.java
+++ /dev/null
@@ -1,317 +0,0 @@
-/*
- * Copyright 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.os;
-
-import android.annotation.SystemApi;
-import android.util.Log;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Container for statsd dimension value information, corresponding to a
- * stats_log.proto's DimensionValue.
- *
- * This consists of a field (an int representing a statsd atom field)
- * and a value (which may be one of a number of types).
- *
- * <p>
- * Only a single value is held, and it is necessarily one of the following types:
- * {@link String}, int, long, boolean, float,
- * or tuple (i.e. {@link List} of {@code StatsDimensionsValue}).
- *
- * The type of value held can be retrieved using {@link #getValueType()}, which returns one of the
- * following ints, depending on the type of value:
- * <ul>
- * <li>{@link #STRING_VALUE_TYPE}</li>
- * <li>{@link #INT_VALUE_TYPE}</li>
- * <li>{@link #LONG_VALUE_TYPE}</li>
- * <li>{@link #BOOLEAN_VALUE_TYPE}</li>
- * <li>{@link #FLOAT_VALUE_TYPE}</li>
- * <li>{@link #TUPLE_VALUE_TYPE}</li>
- * </ul>
- * Alternatively, this can be determined using {@link #isValueType(int)} with one of these constants
- * as a parameter.
- * The value itself can be retrieved using the correct get...Value() function for its type.
- *
- * <p>
- * The field is always an int, and always exists; it can be obtained using {@link #getField()}.
- *
- *
- * @hide
- */
-@SystemApi
-public final class StatsDimensionsValue implements Parcelable {
- private static final String TAG = "StatsDimensionsValue";
-
- // Values of the value type correspond to stats_log.proto's DimensionValue fields.
- // Keep constants in sync with frameworks/base/cmds/statsd/src/HashableDimensionKey.cpp.
- /** Indicates that this holds a String. */
- public static final int STRING_VALUE_TYPE = 2;
- /** Indicates that this holds an int. */
- public static final int INT_VALUE_TYPE = 3;
- /** Indicates that this holds a long. */
- public static final int LONG_VALUE_TYPE = 4;
- /** Indicates that this holds a boolean. */
- public static final int BOOLEAN_VALUE_TYPE = 5;
- /** Indicates that this holds a float. */
- public static final int FLOAT_VALUE_TYPE = 6;
- /** Indicates that this holds a List of StatsDimensionsValues. */
- public static final int TUPLE_VALUE_TYPE = 7;
-
- private final StatsDimensionsValueParcel mInner;
-
- /**
- * Creates a {@code StatsDimensionValue} from a parcel.
- *
- * @hide
- */
- public StatsDimensionsValue(Parcel in) {
- mInner = StatsDimensionsValueParcel.CREATOR.createFromParcel(in);
- }
-
- /**
- * Creates a {@code StatsDimensionsValue} from a StatsDimensionsValueParcel
- *
- * @hide
- */
- public StatsDimensionsValue(StatsDimensionsValueParcel parcel) {
- mInner = parcel;
- }
-
- /**
- * Return the field, i.e. the tag of a statsd atom.
- *
- * @return the field
- */
- public int getField() {
- return mInner.field;
- }
-
- /**
- * Retrieve the String held, if any.
- *
- * @return the {@link String} held if {@link #getValueType()} == {@link #STRING_VALUE_TYPE},
- * null otherwise
- */
- public String getStringValue() {
- if (mInner.valueType == STRING_VALUE_TYPE) {
- return mInner.stringValue;
- } else {
- Log.w(TAG, "Value type is " + getValueTypeAsString() + ", not string.");
- return null;
- }
- }
-
- /**
- * Retrieve the int held, if any.
- *
- * @return the int held if {@link #getValueType()} == {@link #INT_VALUE_TYPE}, 0 otherwise
- */
- public int getIntValue() {
- if (mInner.valueType == INT_VALUE_TYPE) {
- return mInner.intValue;
- } else {
- Log.w(TAG, "Value type is " + getValueTypeAsString() + ", not int.");
- return 0;
- }
- }
-
- /**
- * Retrieve the long held, if any.
- *
- * @return the long held if {@link #getValueType()} == {@link #LONG_VALUE_TYPE}, 0 otherwise
- */
- public long getLongValue() {
- if (mInner.valueType == LONG_VALUE_TYPE) {
- return mInner.longValue;
- } else {
- Log.w(TAG, "Value type is " + getValueTypeAsString() + ", not long.");
- return 0;
- }
- }
-
- /**
- * Retrieve the boolean held, if any.
- *
- * @return the boolean held if {@link #getValueType()} == {@link #BOOLEAN_VALUE_TYPE},
- * false otherwise
- */
- public boolean getBooleanValue() {
- if (mInner.valueType == BOOLEAN_VALUE_TYPE) {
- return mInner.boolValue;
- } else {
- Log.w(TAG, "Value type is " + getValueTypeAsString() + ", not boolean.");
- return false;
- }
- }
-
- /**
- * Retrieve the float held, if any.
- *
- * @return the float held if {@link #getValueType()} == {@link #FLOAT_VALUE_TYPE}, 0 otherwise
- */
- public float getFloatValue() {
- if (mInner.valueType == FLOAT_VALUE_TYPE) {
- return mInner.floatValue;
- } else {
- Log.w(TAG, "Value type is " + getValueTypeAsString() + ", not float.");
- return 0;
- }
- }
-
- /**
- * Retrieve the tuple, in the form of a {@link List} of {@link StatsDimensionsValue}, held,
- * if any.
- *
- * @return the {@link List} of {@link StatsDimensionsValue} held
- * if {@link #getValueType()} == {@link #TUPLE_VALUE_TYPE},
- * null otherwise
- */
- public List<StatsDimensionsValue> getTupleValueList() {
- if (mInner.valueType == TUPLE_VALUE_TYPE) {
- int length = (mInner.tupleValue == null) ? 0 : mInner.tupleValue.length;
- List<StatsDimensionsValue> tupleValues = new ArrayList<>(length);
- for (int i = 0; i < length; i++) {
- tupleValues.add(new StatsDimensionsValue(mInner.tupleValue[i]));
- }
- return tupleValues;
- } else {
- Log.w(TAG, "Value type is " + getValueTypeAsString() + ", not tuple.");
- return null;
- }
- }
-
- /**
- * Returns the constant representing the type of value stored, namely one of
- * <ul>
- * <li>{@link #STRING_VALUE_TYPE}</li>
- * <li>{@link #INT_VALUE_TYPE}</li>
- * <li>{@link #LONG_VALUE_TYPE}</li>
- * <li>{@link #BOOLEAN_VALUE_TYPE}</li>
- * <li>{@link #FLOAT_VALUE_TYPE}</li>
- * <li>{@link #TUPLE_VALUE_TYPE}</li>
- * </ul>
- *
- * @return the constant representing the type of value stored
- */
- public int getValueType() {
- return mInner.valueType;
- }
-
- /**
- * Returns whether the type of value stored is equal to the given type.
- *
- * @param valueType int representing the type of value stored, as used in {@link #getValueType}
- * @return true if {@link #getValueType()} is equal to {@code valueType}.
- */
- public boolean isValueType(int valueType) {
- return mInner.valueType == valueType;
- }
-
- /**
- * Returns a String representing the information in this StatsDimensionValue.
- * No guarantees are made about the format of this String.
- *
- * @return String representation
- *
- * @hide
- */
- // Follows the format of statsd's dimension.h toString.
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append(mInner.field);
- sb.append(":");
- switch (mInner.valueType) {
- case STRING_VALUE_TYPE:
- sb.append(mInner.stringValue);
- break;
- case INT_VALUE_TYPE:
- sb.append(String.valueOf(mInner.intValue));
- break;
- case LONG_VALUE_TYPE:
- sb.append(String.valueOf(mInner.longValue));
- break;
- case BOOLEAN_VALUE_TYPE:
- sb.append(String.valueOf(mInner.boolValue));
- break;
- case FLOAT_VALUE_TYPE:
- sb.append(String.valueOf(mInner.floatValue));
- break;
- case TUPLE_VALUE_TYPE:
- sb.append("{");
- int length = (mInner.tupleValue == null) ? 0 : mInner.tupleValue.length;
- for (int i = 0; i < length; i++) {
- StatsDimensionsValue child = new StatsDimensionsValue(mInner.tupleValue[i]);
- sb.append(child.toString());
- sb.append("|");
- }
- sb.append("}");
- break;
- default:
- Log.w(TAG, "Incorrect value type");
- break;
- }
- return sb.toString();
- }
-
- /**
- * Parcelable Creator for StatsDimensionsValue.
- */
- public static final @android.annotation.NonNull
- Parcelable.Creator<StatsDimensionsValue> CREATOR = new
- Parcelable.Creator<StatsDimensionsValue>() {
- public StatsDimensionsValue createFromParcel(Parcel in) {
- return new StatsDimensionsValue(in);
- }
-
- public StatsDimensionsValue[] newArray(int size) {
- return new StatsDimensionsValue[size];
- }
- };
-
- @Override
- public int describeContents() {
- return 0;
- }
-
- @Override
- public void writeToParcel(Parcel out, int flags) {
- mInner.writeToParcel(out, flags);
- }
-
- /**
- * Returns a string representation of the type of value stored.
- */
- private String getValueTypeAsString() {
- switch (mInner.valueType) {
- case STRING_VALUE_TYPE:
- return "string";
- case INT_VALUE_TYPE:
- return "int";
- case LONG_VALUE_TYPE:
- return "long";
- case BOOLEAN_VALUE_TYPE:
- return "boolean";
- case FLOAT_VALUE_TYPE:
- return "float";
- case TUPLE_VALUE_TYPE:
- return "tuple";
- default:
- return "unknown";
- }
- }
-}
diff --git a/apex/statsd/framework/java/android/os/StatsFrameworkInitializer.java b/apex/statsd/framework/java/android/os/StatsFrameworkInitializer.java
deleted file mode 100644
index 8dc9123..0000000
--- a/apex/statsd/framework/java/android/os/StatsFrameworkInitializer.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2020 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.os;
-
-import android.annotation.NonNull;
-import android.annotation.SystemApi;
-import android.annotation.SystemApi.Client;
-import android.app.StatsManager;
-import android.app.SystemServiceRegistry;
-import android.content.Context;
-
-/**
- * Class for performing registration for all stats services
- *
- * @hide
- */
-@SystemApi(client = Client.MODULE_LIBRARIES)
-public class StatsFrameworkInitializer {
- private StatsFrameworkInitializer() {
- }
-
- private static volatile StatsServiceManager sStatsServiceManager;
-
- /**
- * Sets an instance of {@link StatsServiceManager} that allows
- * the statsd mainline module to register/obtain stats binder services. This is called
- * by the platform during the system initialization.
- *
- * @param statsServiceManager instance of {@link StatsServiceManager} that allows
- * the statsd mainline module to register/obtain statsd binder services.
- */
- public static void setStatsServiceManager(
- @NonNull StatsServiceManager statsServiceManager) {
- if (sStatsServiceManager != null) {
- throw new IllegalStateException("setStatsServiceManager called twice!");
- }
-
- if (statsServiceManager == null) {
- throw new NullPointerException("statsServiceManager is null");
- }
-
- sStatsServiceManager = statsServiceManager;
- }
-
- /** @hide */
- public static StatsServiceManager getStatsServiceManager() {
- return sStatsServiceManager;
- }
-
- /**
- * Called by {@link SystemServiceRegistry}'s static initializer and registers all statsd
- * services to {@link Context}, so that {@link Context#getSystemService} can return them.
- *
- * @throws IllegalStateException if this is called from anywhere besides
- * {@link SystemServiceRegistry}
- */
- public static void registerServiceWrappers() {
- SystemServiceRegistry.registerContextAwareService(
- Context.STATS_MANAGER,
- StatsManager.class,
- context -> new StatsManager(context)
- );
- }
-}
diff --git a/apex/statsd/framework/java/android/util/StatsEvent.java b/apex/statsd/framework/java/android/util/StatsEvent.java
deleted file mode 100644
index 8be5c63..0000000
--- a/apex/statsd/framework/java/android/util/StatsEvent.java
+++ /dev/null
@@ -1,879 +0,0 @@
-/*
- * 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.util;
-
-import static java.nio.charset.StandardCharsets.UTF_8;
-
-import android.annotation.NonNull;
-import android.annotation.Nullable;
-import android.annotation.SystemApi;
-import android.os.SystemClock;
-
-import com.android.internal.annotations.GuardedBy;
-import com.android.internal.annotations.VisibleForTesting;
-
-import java.util.Arrays;
-
-/**
- * StatsEvent builds and stores the buffer sent over the statsd socket.
- * This class defines and encapsulates the socket protocol.
- *
- * <p>Usage:</p>
- * <pre>
- * // Pushed event
- * StatsEvent statsEvent = StatsEvent.newBuilder()
- * .setAtomId(atomId)
- * .writeBoolean(false)
- * .writeString("annotated String field")
- * .addBooleanAnnotation(annotationId, true)
- * .usePooledBuffer()
- * .build();
- * StatsLog.write(statsEvent);
- *
- * // Pulled event
- * StatsEvent statsEvent = StatsEvent.newBuilder()
- * .setAtomId(atomId)
- * .writeBoolean(false)
- * .writeString("annotated String field")
- * .addBooleanAnnotation(annotationId, true)
- * .build();
- * </pre>
- * @hide
- **/
-@SystemApi
-public final class StatsEvent {
- // Type Ids.
- /**
- * @hide
- **/
- @VisibleForTesting
- public static final byte TYPE_INT = 0x00;
-
- /**
- * @hide
- **/
- @VisibleForTesting
- public static final byte TYPE_LONG = 0x01;
-
- /**
- * @hide
- **/
- @VisibleForTesting
- public static final byte TYPE_STRING = 0x02;
-
- /**
- * @hide
- **/
- @VisibleForTesting
- public static final byte TYPE_LIST = 0x03;
-
- /**
- * @hide
- **/
- @VisibleForTesting
- public static final byte TYPE_FLOAT = 0x04;
-
- /**
- * @hide
- **/
- @VisibleForTesting
- public static final byte TYPE_BOOLEAN = 0x05;
-
- /**
- * @hide
- **/
- @VisibleForTesting
- public static final byte TYPE_BYTE_ARRAY = 0x06;
-
- /**
- * @hide
- **/
- @VisibleForTesting
- public static final byte TYPE_OBJECT = 0x07;
-
- /**
- * @hide
- **/
- @VisibleForTesting
- public static final byte TYPE_KEY_VALUE_PAIRS = 0x08;
-
- /**
- * @hide
- **/
- @VisibleForTesting
- public static final byte TYPE_ATTRIBUTION_CHAIN = 0x09;
-
- /**
- * @hide
- **/
- @VisibleForTesting
- public static final byte TYPE_ERRORS = 0x0F;
-
- // Error flags.
- /**
- * @hide
- **/
- @VisibleForTesting
- public static final int ERROR_NO_TIMESTAMP = 0x1;
-
- /**
- * @hide
- **/
- @VisibleForTesting
- public static final int ERROR_NO_ATOM_ID = 0x2;
-
- /**
- * @hide
- **/
- @VisibleForTesting
- public static final int ERROR_OVERFLOW = 0x4;
-
- /**
- * @hide
- **/
- @VisibleForTesting
- public static final int ERROR_ATTRIBUTION_CHAIN_TOO_LONG = 0x8;
-
- /**
- * @hide
- **/
- @VisibleForTesting
- public static final int ERROR_TOO_MANY_KEY_VALUE_PAIRS = 0x10;
-
- /**
- * @hide
- **/
- @VisibleForTesting
- public static final int ERROR_ANNOTATION_DOES_NOT_FOLLOW_FIELD = 0x20;
-
- /**
- * @hide
- **/
- @VisibleForTesting
- public static final int ERROR_INVALID_ANNOTATION_ID = 0x40;
-
- /**
- * @hide
- **/
- @VisibleForTesting
- public static final int ERROR_ANNOTATION_ID_TOO_LARGE = 0x80;
-
- /**
- * @hide
- **/
- @VisibleForTesting
- public static final int ERROR_TOO_MANY_ANNOTATIONS = 0x100;
-
- /**
- * @hide
- **/
- @VisibleForTesting
- public static final int ERROR_TOO_MANY_FIELDS = 0x200;
-
- /**
- * @hide
- **/
- @VisibleForTesting
- public static final int ERROR_ATTRIBUTION_UIDS_TAGS_SIZES_NOT_EQUAL = 0x1000;
-
- /**
- * @hide
- **/
- @VisibleForTesting
- public static final int ERROR_ATOM_ID_INVALID_POSITION = 0x2000;
-
- // Size limits.
-
- /**
- * @hide
- **/
- @VisibleForTesting
- public static final int MAX_ANNOTATION_COUNT = 15;
-
- /**
- * @hide
- **/
- @VisibleForTesting
- public static final int MAX_ATTRIBUTION_NODES = 127;
-
- /**
- * @hide
- **/
- @VisibleForTesting
- public static final int MAX_NUM_ELEMENTS = 127;
-
- /**
- * @hide
- **/
- @VisibleForTesting
- public static final int MAX_KEY_VALUE_PAIRS = 127;
-
- private static final int LOGGER_ENTRY_MAX_PAYLOAD = 4068;
-
- // Max payload size is 4 bytes less as 4 bytes are reserved for statsEventTag.
- // See android_util_StatsLog.cpp.
- private static final int MAX_PUSH_PAYLOAD_SIZE = LOGGER_ENTRY_MAX_PAYLOAD - 4;
-
- private static final int MAX_PULL_PAYLOAD_SIZE = 50 * 1024; // 50 KB
-
- private final int mAtomId;
- private final byte[] mPayload;
- private Buffer mBuffer;
- private final int mNumBytes;
-
- private StatsEvent(final int atomId, @Nullable final Buffer buffer,
- @NonNull final byte[] payload, final int numBytes) {
- mAtomId = atomId;
- mBuffer = buffer;
- mPayload = payload;
- mNumBytes = numBytes;
- }
-
- /**
- * Returns a new StatsEvent.Builder for building StatsEvent object.
- **/
- @NonNull
- public static StatsEvent.Builder newBuilder() {
- return new StatsEvent.Builder(Buffer.obtain());
- }
-
- /**
- * Get the atom Id of the atom encoded in this StatsEvent object.
- *
- * @hide
- **/
- public int getAtomId() {
- return mAtomId;
- }
-
- /**
- * Get the byte array that contains the encoded payload that can be sent to statsd.
- *
- * @hide
- **/
- @NonNull
- public byte[] getBytes() {
- return mPayload;
- }
-
- /**
- * Get the number of bytes used to encode the StatsEvent payload.
- *
- * @hide
- **/
- public int getNumBytes() {
- return mNumBytes;
- }
-
- /**
- * Recycle resources used by this StatsEvent object.
- * No actions should be taken on this StatsEvent after release() is called.
- *
- * @hide
- **/
- public void release() {
- if (mBuffer != null) {
- mBuffer.release();
- mBuffer = null;
- }
- }
-
- /**
- * Builder for constructing a StatsEvent object.
- *
- * <p>This class defines and encapsulates the socket encoding for the buffer.
- * The write methods must be called in the same order as the order of fields in the
- * atom definition.</p>
- *
- * <p>setAtomId() can be called anytime before build().</p>
- *
- * <p>Example:</p>
- * <pre>
- * // Atom definition.
- * message MyAtom {
- * optional int32 field1 = 1;
- * optional int64 field2 = 2;
- * optional string field3 = 3 [(annotation1) = true];
- * }
- *
- * // StatsEvent construction for pushed event.
- * StatsEvent.newBuilder()
- * StatsEvent statsEvent = StatsEvent.newBuilder()
- * .setAtomId(atomId)
- * .writeInt(3) // field1
- * .writeLong(8L) // field2
- * .writeString("foo") // field 3
- * .addBooleanAnnotation(annotation1Id, true)
- * .usePooledBuffer()
- * .build();
- *
- * // StatsEvent construction for pulled event.
- * StatsEvent.newBuilder()
- * StatsEvent statsEvent = StatsEvent.newBuilder()
- * .setAtomId(atomId)
- * .writeInt(3) // field1
- * .writeLong(8L) // field2
- * .writeString("foo") // field 3
- * .addBooleanAnnotation(annotation1Id, true)
- * .build();
- * </pre>
- **/
- public static final class Builder {
- // Fixed positions.
- private static final int POS_NUM_ELEMENTS = 1;
- private static final int POS_TIMESTAMP_NS = POS_NUM_ELEMENTS + Byte.BYTES;
- private static final int POS_ATOM_ID = POS_TIMESTAMP_NS + Byte.BYTES + Long.BYTES;
-
- private final Buffer mBuffer;
- private long mTimestampNs;
- private int mAtomId;
- private byte mCurrentAnnotationCount;
- private int mPos;
- private int mPosLastField;
- private byte mLastType;
- private int mNumElements;
- private int mErrorMask;
- private boolean mUsePooledBuffer = false;
-
- private Builder(final Buffer buffer) {
- mBuffer = buffer;
- mCurrentAnnotationCount = 0;
- mAtomId = 0;
- mTimestampNs = SystemClock.elapsedRealtimeNanos();
- mNumElements = 0;
-
- // Set mPos to 0 for writing TYPE_OBJECT at 0th position.
- mPos = 0;
- writeTypeId(TYPE_OBJECT);
-
- // Write timestamp.
- mPos = POS_TIMESTAMP_NS;
- writeLong(mTimestampNs);
- }
-
- /**
- * Sets the atom id for this StatsEvent.
- *
- * This should be called immediately after StatsEvent.newBuilder()
- * and should only be called once.
- * Not calling setAtomId will result in ERROR_NO_ATOM_ID.
- * Calling setAtomId out of order will result in ERROR_ATOM_ID_INVALID_POSITION.
- **/
- @NonNull
- public Builder setAtomId(final int atomId) {
- if (0 == mAtomId) {
- mAtomId = atomId;
-
- if (1 == mNumElements) { // Only timestamp is written so far.
- writeInt(atomId);
- } else {
- // setAtomId called out of order.
- mErrorMask |= ERROR_ATOM_ID_INVALID_POSITION;
- }
- }
-
- return this;
- }
-
- /**
- * Write a boolean field to this StatsEvent.
- **/
- @NonNull
- public Builder writeBoolean(final boolean value) {
- // Write boolean typeId byte followed by boolean byte representation.
- writeTypeId(TYPE_BOOLEAN);
- mPos += mBuffer.putBoolean(mPos, value);
- mNumElements++;
- return this;
- }
-
- /**
- * Write an integer field to this StatsEvent.
- **/
- @NonNull
- public Builder writeInt(final int value) {
- // Write integer typeId byte followed by 4-byte representation of value.
- writeTypeId(TYPE_INT);
- mPos += mBuffer.putInt(mPos, value);
- mNumElements++;
- return this;
- }
-
- /**
- * Write a long field to this StatsEvent.
- **/
- @NonNull
- public Builder writeLong(final long value) {
- // Write long typeId byte followed by 8-byte representation of value.
- writeTypeId(TYPE_LONG);
- mPos += mBuffer.putLong(mPos, value);
- mNumElements++;
- return this;
- }
-
- /**
- * Write a float field to this StatsEvent.
- **/
- @NonNull
- public Builder writeFloat(final float value) {
- // Write float typeId byte followed by 4-byte representation of value.
- writeTypeId(TYPE_FLOAT);
- mPos += mBuffer.putFloat(mPos, value);
- mNumElements++;
- return this;
- }
-
- /**
- * Write a String field to this StatsEvent.
- **/
- @NonNull
- public Builder writeString(@NonNull final String value) {
- // Write String typeId byte, followed by 4-byte representation of number of bytes
- // in the UTF-8 encoding, followed by the actual UTF-8 byte encoding of value.
- final byte[] valueBytes = stringToBytes(value);
- writeByteArray(valueBytes, TYPE_STRING);
- return this;
- }
-
- /**
- * Write a byte array field to this StatsEvent.
- **/
- @NonNull
- public Builder writeByteArray(@NonNull final byte[] value) {
- // Write byte array typeId byte, followed by 4-byte representation of number of bytes
- // in value, followed by the actual byte array.
- writeByteArray(value, TYPE_BYTE_ARRAY);
- return this;
- }
-
- private void writeByteArray(@NonNull final byte[] value, final byte typeId) {
- writeTypeId(typeId);
- final int numBytes = value.length;
- mPos += mBuffer.putInt(mPos, numBytes);
- mPos += mBuffer.putByteArray(mPos, value);
- mNumElements++;
- }
-
- /**
- * Write an attribution chain field to this StatsEvent.
- *
- * The sizes of uids and tags must be equal. The AttributionNode at position i is
- * made up of uids[i] and tags[i].
- *
- * @param uids array of uids in the attribution nodes.
- * @param tags array of tags in the attribution nodes.
- **/
- @NonNull
- public Builder writeAttributionChain(
- @NonNull final int[] uids, @NonNull final String[] tags) {
- final byte numUids = (byte) uids.length;
- final byte numTags = (byte) tags.length;
-
- if (numUids != numTags) {
- mErrorMask |= ERROR_ATTRIBUTION_UIDS_TAGS_SIZES_NOT_EQUAL;
- } else if (numUids > MAX_ATTRIBUTION_NODES) {
- mErrorMask |= ERROR_ATTRIBUTION_CHAIN_TOO_LONG;
- } else {
- // Write attribution chain typeId byte, followed by 1-byte representation of
- // number of attribution nodes, followed by encoding of each attribution node.
- writeTypeId(TYPE_ATTRIBUTION_CHAIN);
- mPos += mBuffer.putByte(mPos, numUids);
- for (int i = 0; i < numUids; i++) {
- // Each uid is encoded as 4-byte representation of its int value.
- mPos += mBuffer.putInt(mPos, uids[i]);
-
- // Each tag is encoded as 4-byte representation of number of bytes in its
- // UTF-8 encoding, followed by the actual UTF-8 bytes.
- final byte[] tagBytes = stringToBytes(tags[i]);
- mPos += mBuffer.putInt(mPos, tagBytes.length);
- mPos += mBuffer.putByteArray(mPos, tagBytes);
- }
- mNumElements++;
- }
- return this;
- }
-
- /**
- * Write KeyValuePairsAtom entries to this StatsEvent.
- *
- * @param intMap Integer key-value pairs.
- * @param longMap Long key-value pairs.
- * @param stringMap String key-value pairs.
- * @param floatMap Float key-value pairs.
- **/
- @NonNull
- public Builder writeKeyValuePairs(
- @Nullable final SparseIntArray intMap,
- @Nullable final SparseLongArray longMap,
- @Nullable final SparseArray<String> stringMap,
- @Nullable final SparseArray<Float> floatMap) {
- final int intMapSize = null == intMap ? 0 : intMap.size();
- final int longMapSize = null == longMap ? 0 : longMap.size();
- final int stringMapSize = null == stringMap ? 0 : stringMap.size();
- final int floatMapSize = null == floatMap ? 0 : floatMap.size();
- final int totalCount = intMapSize + longMapSize + stringMapSize + floatMapSize;
-
- if (totalCount > MAX_KEY_VALUE_PAIRS) {
- mErrorMask |= ERROR_TOO_MANY_KEY_VALUE_PAIRS;
- } else {
- writeTypeId(TYPE_KEY_VALUE_PAIRS);
- mPos += mBuffer.putByte(mPos, (byte) totalCount);
-
- for (int i = 0; i < intMapSize; i++) {
- final int key = intMap.keyAt(i);
- final int value = intMap.valueAt(i);
- mPos += mBuffer.putInt(mPos, key);
- writeTypeId(TYPE_INT);
- mPos += mBuffer.putInt(mPos, value);
- }
-
- for (int i = 0; i < longMapSize; i++) {
- final int key = longMap.keyAt(i);
- final long value = longMap.valueAt(i);
- mPos += mBuffer.putInt(mPos, key);
- writeTypeId(TYPE_LONG);
- mPos += mBuffer.putLong(mPos, value);
- }
-
- for (int i = 0; i < stringMapSize; i++) {
- final int key = stringMap.keyAt(i);
- final String value = stringMap.valueAt(i);
- mPos += mBuffer.putInt(mPos, key);
- writeTypeId(TYPE_STRING);
- final byte[] valueBytes = stringToBytes(value);
- mPos += mBuffer.putInt(mPos, valueBytes.length);
- mPos += mBuffer.putByteArray(mPos, valueBytes);
- }
-
- for (int i = 0; i < floatMapSize; i++) {
- final int key = floatMap.keyAt(i);
- final float value = floatMap.valueAt(i);
- mPos += mBuffer.putInt(mPos, key);
- writeTypeId(TYPE_FLOAT);
- mPos += mBuffer.putFloat(mPos, value);
- }
-
- mNumElements++;
- }
-
- return this;
- }
-
- /**
- * Write a boolean annotation for the last field written.
- **/
- @NonNull
- public Builder addBooleanAnnotation(
- final byte annotationId, final boolean value) {
- // Ensure there's a field written to annotate.
- if (mNumElements < 2) {
- mErrorMask |= ERROR_ANNOTATION_DOES_NOT_FOLLOW_FIELD;
- } else if (mCurrentAnnotationCount >= MAX_ANNOTATION_COUNT) {
- mErrorMask |= ERROR_TOO_MANY_ANNOTATIONS;
- } else {
- mPos += mBuffer.putByte(mPos, annotationId);
- mPos += mBuffer.putByte(mPos, TYPE_BOOLEAN);
- mPos += mBuffer.putBoolean(mPos, value);
- mCurrentAnnotationCount++;
- writeAnnotationCount();
- }
-
- return this;
- }
-
- /**
- * Write an integer annotation for the last field written.
- **/
- @NonNull
- public Builder addIntAnnotation(final byte annotationId, final int value) {
- if (mNumElements < 2) {
- mErrorMask |= ERROR_ANNOTATION_DOES_NOT_FOLLOW_FIELD;
- } else if (mCurrentAnnotationCount >= MAX_ANNOTATION_COUNT) {
- mErrorMask |= ERROR_TOO_MANY_ANNOTATIONS;
- } else {
- mPos += mBuffer.putByte(mPos, annotationId);
- mPos += mBuffer.putByte(mPos, TYPE_INT);
- mPos += mBuffer.putInt(mPos, value);
- mCurrentAnnotationCount++;
- writeAnnotationCount();
- }
-
- return this;
- }
-
- /**
- * Indicates to reuse Buffer's byte array as the underlying payload in StatsEvent.
- * This should be called for pushed events to reduce memory allocations and garbage
- * collections.
- **/
- @NonNull
- public Builder usePooledBuffer() {
- mUsePooledBuffer = true;
- mBuffer.setMaxSize(MAX_PUSH_PAYLOAD_SIZE, mPos);
- return this;
- }
-
- /**
- * Builds a StatsEvent object with values entered in this Builder.
- **/
- @NonNull
- public StatsEvent build() {
- if (0L == mTimestampNs) {
- mErrorMask |= ERROR_NO_TIMESTAMP;
- }
- if (0 == mAtomId) {
- mErrorMask |= ERROR_NO_ATOM_ID;
- }
- if (mBuffer.hasOverflowed()) {
- mErrorMask |= ERROR_OVERFLOW;
- }
- if (mNumElements > MAX_NUM_ELEMENTS) {
- mErrorMask |= ERROR_TOO_MANY_FIELDS;
- }
-
- if (0 == mErrorMask) {
- mBuffer.putByte(POS_NUM_ELEMENTS, (byte) mNumElements);
- } else {
- // Write atom id and error mask. Overwrite any annotations for atom Id.
- mPos = POS_ATOM_ID;
- mPos += mBuffer.putByte(mPos, TYPE_INT);
- mPos += mBuffer.putInt(mPos, mAtomId);
- mPos += mBuffer.putByte(mPos, TYPE_ERRORS);
- mPos += mBuffer.putInt(mPos, mErrorMask);
- mBuffer.putByte(POS_NUM_ELEMENTS, (byte) 3);
- }
-
- final int size = mPos;
-
- if (mUsePooledBuffer) {
- return new StatsEvent(mAtomId, mBuffer, mBuffer.getBytes(), size);
- } else {
- // Create a copy of the buffer with the required number of bytes.
- final byte[] payload = new byte[size];
- System.arraycopy(mBuffer.getBytes(), 0, payload, 0, size);
-
- // Return Buffer instance to the pool.
- mBuffer.release();
-
- return new StatsEvent(mAtomId, null, payload, size);
- }
- }
-
- private void writeTypeId(final byte typeId) {
- mPosLastField = mPos;
- mLastType = typeId;
- mCurrentAnnotationCount = 0;
- final byte encodedId = (byte) (typeId & 0x0F);
- mPos += mBuffer.putByte(mPos, encodedId);
- }
-
- private void writeAnnotationCount() {
- // Use first 4 bits for annotation count and last 4 bits for typeId.
- final byte encodedId = (byte) ((mCurrentAnnotationCount << 4) | (mLastType & 0x0F));
- mBuffer.putByte(mPosLastField, encodedId);
- }
-
- @NonNull
- private static byte[] stringToBytes(@Nullable final String value) {
- return (null == value ? "" : value).getBytes(UTF_8);
- }
- }
-
- private static final class Buffer {
- private static Object sLock = new Object();
-
- @GuardedBy("sLock")
- private static Buffer sPool;
-
- private byte[] mBytes = new byte[MAX_PUSH_PAYLOAD_SIZE];
- private boolean mOverflow = false;
- private int mMaxSize = MAX_PULL_PAYLOAD_SIZE;
-
- @NonNull
- private static Buffer obtain() {
- final Buffer buffer;
- synchronized (sLock) {
- buffer = null == sPool ? new Buffer() : sPool;
- sPool = null;
- }
- buffer.reset();
- return buffer;
- }
-
- private Buffer() {
- }
-
- @NonNull
- private byte[] getBytes() {
- return mBytes;
- }
-
- private void release() {
- // Recycle this Buffer if its size is MAX_PUSH_PAYLOAD_SIZE or under.
- if (mBytes.length <= MAX_PUSH_PAYLOAD_SIZE) {
- synchronized (sLock) {
- if (null == sPool) {
- sPool = this;
- }
- }
- }
- }
-
- private void reset() {
- mOverflow = false;
- mMaxSize = MAX_PULL_PAYLOAD_SIZE;
- }
-
- private void setMaxSize(final int maxSize, final int numBytesWritten) {
- mMaxSize = maxSize;
- if (numBytesWritten > maxSize) {
- mOverflow = true;
- }
- }
-
- private boolean hasOverflowed() {
- return mOverflow;
- }
-
- /**
- * Checks for available space in the byte array.
- *
- * @param index starting position in the buffer to start the check.
- * @param numBytes number of bytes to check from index.
- * @return true if space is available, false otherwise.
- **/
- private boolean hasEnoughSpace(final int index, final int numBytes) {
- final int totalBytesNeeded = index + numBytes;
-
- if (totalBytesNeeded > mMaxSize) {
- mOverflow = true;
- return false;
- }
-
- // Expand buffer if needed.
- if (mBytes.length < mMaxSize && totalBytesNeeded > mBytes.length) {
- int newSize = mBytes.length;
- do {
- newSize *= 2;
- } while (newSize <= totalBytesNeeded);
-
- if (newSize > mMaxSize) {
- newSize = mMaxSize;
- }
-
- mBytes = Arrays.copyOf(mBytes, newSize);
- }
-
- return true;
- }
-
- /**
- * Writes a byte into the buffer.
- *
- * @param index position in the buffer where the byte is written.
- * @param value the byte to write.
- * @return number of bytes written to buffer from this write operation.
- **/
- private int putByte(final int index, final byte value) {
- if (hasEnoughSpace(index, Byte.BYTES)) {
- mBytes[index] = (byte) (value);
- return Byte.BYTES;
- }
- return 0;
- }
-
- /**
- * Writes a boolean into the buffer.
- *
- * @param index position in the buffer where the boolean is written.
- * @param value the boolean to write.
- * @return number of bytes written to buffer from this write operation.
- **/
- private int putBoolean(final int index, final boolean value) {
- return putByte(index, (byte) (value ? 1 : 0));
- }
-
- /**
- * Writes an integer into the buffer.
- *
- * @param index position in the buffer where the integer is written.
- * @param value the integer to write.
- * @return number of bytes written to buffer from this write operation.
- **/
- private int putInt(final int index, final int value) {
- if (hasEnoughSpace(index, Integer.BYTES)) {
- // Use little endian byte order.
- mBytes[index] = (byte) (value);
- mBytes[index + 1] = (byte) (value >> 8);
- mBytes[index + 2] = (byte) (value >> 16);
- mBytes[index + 3] = (byte) (value >> 24);
- return Integer.BYTES;
- }
- return 0;
- }
-
- /**
- * Writes a long into the buffer.
- *
- * @param index position in the buffer where the long is written.
- * @param value the long to write.
- * @return number of bytes written to buffer from this write operation.
- **/
- private int putLong(final int index, final long value) {
- if (hasEnoughSpace(index, Long.BYTES)) {
- // Use little endian byte order.
- mBytes[index] = (byte) (value);
- mBytes[index + 1] = (byte) (value >> 8);
- mBytes[index + 2] = (byte) (value >> 16);
- mBytes[index + 3] = (byte) (value >> 24);
- mBytes[index + 4] = (byte) (value >> 32);
- mBytes[index + 5] = (byte) (value >> 40);
- mBytes[index + 6] = (byte) (value >> 48);
- mBytes[index + 7] = (byte) (value >> 56);
- return Long.BYTES;
- }
- return 0;
- }
-
- /**
- * Writes a float into the buffer.
- *
- * @param index position in the buffer where the float is written.
- * @param value the float to write.
- * @return number of bytes written to buffer from this write operation.
- **/
- private int putFloat(final int index, final float value) {
- return putInt(index, Float.floatToIntBits(value));
- }
-
- /**
- * Copies a byte array into the buffer.
- *
- * @param index position in the buffer where the byte array is copied.
- * @param value the byte array to copy.
- * @return number of bytes written to buffer from this write operation.
- **/
- private int putByteArray(final int index, @NonNull final byte[] value) {
- final int numBytes = value.length;
- if (hasEnoughSpace(index, numBytes)) {
- System.arraycopy(value, 0, mBytes, index, numBytes);
- return numBytes;
- }
- return 0;
- }
- }
-}
diff --git a/apex/statsd/framework/java/android/util/StatsLog.java b/apex/statsd/framework/java/android/util/StatsLog.java
deleted file mode 100644
index 0a9f4eb..0000000
--- a/apex/statsd/framework/java/android/util/StatsLog.java
+++ /dev/null
@@ -1,185 +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.util;
-
-import static android.Manifest.permission.DUMP;
-import static android.Manifest.permission.PACKAGE_USAGE_STATS;
-
-import android.Manifest;
-import android.annotation.NonNull;
-import android.annotation.RequiresPermission;
-import android.annotation.SystemApi;
-import android.content.Context;
-import android.os.IStatsd;
-import android.os.Process;
-import android.util.proto.ProtoOutputStream;
-
-import com.android.internal.statsd.StatsdStatsLog;
-
-/**
- * StatsLog provides an API for developers to send events to statsd. The events can be used to
- * define custom metrics inside statsd.
- */
-public final class StatsLog {
-
- // Load JNI library
- static {
- System.loadLibrary("stats_jni");
- }
- private static final String TAG = "StatsLog";
- private static final boolean DEBUG = false;
- private static final int EXPERIMENT_IDS_FIELD_ID = 1;
-
- private StatsLog() {
- }
-
- /**
- * Logs a start event.
- *
- * @param label developer-chosen label.
- * @return True if the log request was sent to statsd.
- */
- public static boolean logStart(int label) {
- int callingUid = Process.myUid();
- StatsdStatsLog.write(
- StatsdStatsLog.APP_BREADCRUMB_REPORTED,
- callingUid,
- label,
- StatsdStatsLog.APP_BREADCRUMB_REPORTED__STATE__START);
- return true;
- }
-
- /**
- * Logs a stop event.
- *
- * @param label developer-chosen label.
- * @return True if the log request was sent to statsd.
- */
- public static boolean logStop(int label) {
- int callingUid = Process.myUid();
- StatsdStatsLog.write(
- StatsdStatsLog.APP_BREADCRUMB_REPORTED,
- callingUid,
- label,
- StatsdStatsLog.APP_BREADCRUMB_REPORTED__STATE__STOP);
- return true;
- }
-
- /**
- * Logs an event that does not represent a start or stop boundary.
- *
- * @param label developer-chosen label.
- * @return True if the log request was sent to statsd.
- */
- public static boolean logEvent(int label) {
- int callingUid = Process.myUid();
- StatsdStatsLog.write(
- StatsdStatsLog.APP_BREADCRUMB_REPORTED,
- callingUid,
- label,
- StatsdStatsLog.APP_BREADCRUMB_REPORTED__STATE__UNSPECIFIED);
- return true;
- }
-
- /**
- * Logs an event for binary push for module updates.
- *
- * @param trainName name of install train.
- * @param trainVersionCode version code of the train.
- * @param options optional flags about this install.
- * The last 3 bits indicate options:
- * 0x01: FLAG_REQUIRE_STAGING
- * 0x02: FLAG_ROLLBACK_ENABLED
- * 0x04: FLAG_REQUIRE_LOW_LATENCY_MONITOR
- * @param state current install state. Defined as State enums in
- * BinaryPushStateChanged atom in
- * frameworks/base/cmds/statsd/src/atoms.proto
- * @param experimentIds experiment ids.
- * @return True if the log request was sent to statsd.
- */
- @RequiresPermission(allOf = {DUMP, PACKAGE_USAGE_STATS})
- public static boolean logBinaryPushStateChanged(@NonNull String trainName,
- long trainVersionCode, int options, int state,
- @NonNull long[] experimentIds) {
- ProtoOutputStream proto = new ProtoOutputStream();
- for (long id : experimentIds) {
- proto.write(
- ProtoOutputStream.FIELD_TYPE_INT64
- | ProtoOutputStream.FIELD_COUNT_REPEATED
- | EXPERIMENT_IDS_FIELD_ID,
- id);
- }
- StatsdStatsLog.write(StatsdStatsLog.BINARY_PUSH_STATE_CHANGED,
- trainName,
- trainVersionCode,
- (options & IStatsd.FLAG_REQUIRE_STAGING) > 0,
- (options & IStatsd.FLAG_ROLLBACK_ENABLED) > 0,
- (options & IStatsd.FLAG_REQUIRE_LOW_LATENCY_MONITOR) > 0,
- state,
- proto.getBytes(),
- 0,
- 0,
- false);
- return true;
- }
-
- /**
- * Write an event to stats log using the raw format.
- *
- * @param buffer The encoded buffer of data to write.
- * @param size The number of bytes from the buffer to write.
- * @hide
- */
- // TODO(b/144935988): Mark deprecated.
- @SystemApi
- public static void writeRaw(@NonNull byte[] buffer, int size) {
- // TODO(b/144935988): make this no-op once clients have migrated to StatsEvent.
- writeImpl(buffer, size, 0);
- }
-
- /**
- * Write an event to stats log using the raw format.
- *
- * @param buffer The encoded buffer of data to write.
- * @param size The number of bytes from the buffer to write.
- * @param atomId The id of the atom to which the event belongs.
- */
- private static native void writeImpl(@NonNull byte[] buffer, int size, int atomId);
-
- /**
- * Write an event to stats log using the raw format encapsulated in StatsEvent.
- * After writing to stats log, release() is called on the StatsEvent object.
- * No further action should be taken on the StatsEvent object following this call.
- *
- * @param statsEvent The StatsEvent object containing the encoded buffer of data to write.
- * @hide
- */
- @SystemApi
- public static void write(@NonNull final StatsEvent statsEvent) {
- writeImpl(statsEvent.getBytes(), statsEvent.getNumBytes(), statsEvent.getAtomId());
- statsEvent.release();
- }
-
- private static void enforceDumpCallingPermission(Context context) {
- context.enforceCallingPermission(android.Manifest.permission.DUMP, "Need DUMP permission.");
- }
-
- private static void enforcesageStatsCallingPermission(Context context) {
- context.enforceCallingPermission(Manifest.permission.PACKAGE_USAGE_STATS,
- "Need PACKAGE_USAGE_STATS permission.");
- }
-}
diff --git a/apex/statsd/framework/test/Android.bp b/apex/statsd/framework/test/Android.bp
deleted file mode 100644
index 5cc5647..0000000
--- a/apex/statsd/framework/test/Android.bp
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright (C) 2020 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.
-
-android_test {
- name: "FrameworkStatsdTest",
- sdk_version: "module_current",
- srcs: [ "**/*.java" ],
- manifest: "AndroidManifest.xml",
- static_libs: [
- "androidx.test.rules",
- "truth-prebuilt",
- ],
- libs: [
- "android.test.runner.stubs",
- "android.test.base.stubs",
- "framework-statsd.impl",
- ],
- test_suites: [
- "device-tests",
- "mts",
- ],
-}
diff --git a/apex/statsd/framework/test/AndroidManifest.xml b/apex/statsd/framework/test/AndroidManifest.xml
deleted file mode 100644
index 8f89d23..0000000
--- a/apex/statsd/framework/test/AndroidManifest.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2020 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.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.os.statsd.framework.test"
- >
-
- <instrumentation
- android:name="androidx.test.runner.AndroidJUnitRunner"
- android:targetPackage="com.android.os.statsd.framework.test"
- android:label="Framework Statsd Tests" />
-
-</manifest>
diff --git a/apex/statsd/framework/test/AndroidTest.xml b/apex/statsd/framework/test/AndroidTest.xml
deleted file mode 100644
index fb51915..0000000
--- a/apex/statsd/framework/test/AndroidTest.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2020 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.
--->
-<configuration description="Runs Tests for Statsd.">
- <target_preparer class="com.android.tradefed.targetprep.TestAppInstallSetup">
- <option name="test-file-name" value="FrameworkStatsdTest.apk" />
- <option name="install-arg" value="-g" />
- </target_preparer>
-
- <option name="test-suite-tag" value="apct" />
- <option name="test-suite-tag" value="mts" />
- <option name="test-tag" value="FrameworkStatsdTest" />
- <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
- <option name="package" value="com.android.os.statsd.framework.test" />
- <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />
- <option name="hidden-api-checks" value="false"/>
- </test>
-
- <object type="module_controller" class="com.android.tradefed.testtype.suite.module.MainlineTestModuleController">
- <option name="mainline-module-package-name" value="com.google.android.os.statsd" />
- </object>
-</configuration>
\ No newline at end of file
diff --git a/apex/statsd/framework/test/src/android/app/PullAtomMetadataTest.java b/apex/statsd/framework/test/src/android/app/PullAtomMetadataTest.java
deleted file mode 100644
index fd386bd..0000000
--- a/apex/statsd/framework/test/src/android/app/PullAtomMetadataTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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 static com.google.common.truth.Truth.assertThat;
-
-import android.app.StatsManager.PullAtomMetadata;
-
-import androidx.test.filters.SmallTest;
-import androidx.test.runner.AndroidJUnit4;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-@SmallTest
-@RunWith(AndroidJUnit4.class)
-public final class PullAtomMetadataTest {
-
- @Test
- public void testEmpty() {
- PullAtomMetadata metadata = new PullAtomMetadata.Builder().build();
- assertThat(metadata.getTimeoutMillis()).isEqualTo(StatsManager.DEFAULT_TIMEOUT_MILLIS);
- assertThat(metadata.getCoolDownMillis()).isEqualTo(StatsManager.DEFAULT_COOL_DOWN_MILLIS);
- assertThat(metadata.getAdditiveFields()).isNull();
- }
-
- @Test
- public void testSetTimeoutMillis() {
- long timeoutMillis = 500L;
- PullAtomMetadata metadata =
- new PullAtomMetadata.Builder().setTimeoutMillis(timeoutMillis).build();
- assertThat(metadata.getTimeoutMillis()).isEqualTo(timeoutMillis);
- assertThat(metadata.getCoolDownMillis()).isEqualTo(StatsManager.DEFAULT_COOL_DOWN_MILLIS);
- assertThat(metadata.getAdditiveFields()).isNull();
- }
-
- @Test
- public void testSetCoolDownMillis() {
- long coolDownMillis = 10_000L;
- PullAtomMetadata metadata =
- new PullAtomMetadata.Builder().setCoolDownMillis(coolDownMillis).build();
- assertThat(metadata.getTimeoutMillis()).isEqualTo(StatsManager.DEFAULT_TIMEOUT_MILLIS);
- assertThat(metadata.getCoolDownMillis()).isEqualTo(coolDownMillis);
- assertThat(metadata.getAdditiveFields()).isNull();
- }
-
- @Test
- public void testSetAdditiveFields() {
- int[] fields = {2, 4, 6};
- PullAtomMetadata metadata =
- new PullAtomMetadata.Builder().setAdditiveFields(fields).build();
- assertThat(metadata.getTimeoutMillis()).isEqualTo(StatsManager.DEFAULT_TIMEOUT_MILLIS);
- assertThat(metadata.getCoolDownMillis()).isEqualTo(StatsManager.DEFAULT_COOL_DOWN_MILLIS);
- assertThat(metadata.getAdditiveFields()).isEqualTo(fields);
- }
-
- @Test
- public void testSetAllElements() {
- long timeoutMillis = 300L;
- long coolDownMillis = 9572L;
- int[] fields = {3, 2};
- PullAtomMetadata metadata = new PullAtomMetadata.Builder()
- .setTimeoutMillis(timeoutMillis)
- .setCoolDownMillis(coolDownMillis)
- .setAdditiveFields(fields)
- .build();
- assertThat(metadata.getTimeoutMillis()).isEqualTo(timeoutMillis);
- assertThat(metadata.getCoolDownMillis()).isEqualTo(coolDownMillis);
- assertThat(metadata.getAdditiveFields()).isEqualTo(fields);
- }
-}
diff --git a/apex/statsd/framework/test/src/android/os/StatsDimensionsValueTest.java b/apex/statsd/framework/test/src/android/os/StatsDimensionsValueTest.java
deleted file mode 100644
index db25911..0000000
--- a/apex/statsd/framework/test/src/android/os/StatsDimensionsValueTest.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * 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.os;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-import java.util.List;
-
-@RunWith(JUnit4.class)
-public final class StatsDimensionsValueTest {
-
- @Test
- public void testConversionFromStructuredParcel() {
- int tupleField = 100; // atom id
- String stringValue = "Hello";
- int intValue = 123;
- long longValue = 123456789L;
- float floatValue = 1.1f;
- boolean boolValue = true;
-
- // Construct structured parcel
- StatsDimensionsValueParcel sdvp = new StatsDimensionsValueParcel();
- sdvp.field = tupleField;
- sdvp.valueType = StatsDimensionsValue.TUPLE_VALUE_TYPE;
- sdvp.tupleValue = new StatsDimensionsValueParcel[5];
-
- for (int i = 0; i < 5; i++) {
- sdvp.tupleValue[i] = new StatsDimensionsValueParcel();
- sdvp.tupleValue[i].field = i + 1;
- }
-
- sdvp.tupleValue[0].valueType = StatsDimensionsValue.STRING_VALUE_TYPE;
- sdvp.tupleValue[1].valueType = StatsDimensionsValue.INT_VALUE_TYPE;
- sdvp.tupleValue[2].valueType = StatsDimensionsValue.LONG_VALUE_TYPE;
- sdvp.tupleValue[3].valueType = StatsDimensionsValue.FLOAT_VALUE_TYPE;
- sdvp.tupleValue[4].valueType = StatsDimensionsValue.BOOLEAN_VALUE_TYPE;
-
- sdvp.tupleValue[0].stringValue = stringValue;
- sdvp.tupleValue[1].intValue = intValue;
- sdvp.tupleValue[2].longValue = longValue;
- sdvp.tupleValue[3].floatValue = floatValue;
- sdvp.tupleValue[4].boolValue = boolValue;
-
- // Convert to StatsDimensionsValue and check result
- StatsDimensionsValue sdv = new StatsDimensionsValue(sdvp);
-
- assertThat(sdv.getField()).isEqualTo(tupleField);
- assertThat(sdv.getValueType()).isEqualTo(StatsDimensionsValue.TUPLE_VALUE_TYPE);
- List<StatsDimensionsValue> sdvChildren = sdv.getTupleValueList();
- assertThat(sdvChildren.size()).isEqualTo(5);
-
- for (int i = 0; i < 5; i++) {
- assertThat(sdvChildren.get(i).getField()).isEqualTo(i + 1);
- }
-
- assertThat(sdvChildren.get(0).getValueType())
- .isEqualTo(StatsDimensionsValue.STRING_VALUE_TYPE);
- assertThat(sdvChildren.get(1).getValueType())
- .isEqualTo(StatsDimensionsValue.INT_VALUE_TYPE);
- assertThat(sdvChildren.get(2).getValueType())
- .isEqualTo(StatsDimensionsValue.LONG_VALUE_TYPE);
- assertThat(sdvChildren.get(3).getValueType())
- .isEqualTo(StatsDimensionsValue.FLOAT_VALUE_TYPE);
- assertThat(sdvChildren.get(4).getValueType())
- .isEqualTo(StatsDimensionsValue.BOOLEAN_VALUE_TYPE);
-
- assertThat(sdvChildren.get(0).getStringValue()).isEqualTo(stringValue);
- assertThat(sdvChildren.get(1).getIntValue()).isEqualTo(intValue);
- assertThat(sdvChildren.get(2).getLongValue()).isEqualTo(longValue);
- assertThat(sdvChildren.get(3).getFloatValue()).isEqualTo(floatValue);
- assertThat(sdvChildren.get(4).getBooleanValue()).isEqualTo(boolValue);
-
- // Ensure that StatsDimensionsValue and StatsDimensionsValueParcel are
- // parceled equivalently
- Parcel sdvpParcel = Parcel.obtain();
- Parcel sdvParcel = Parcel.obtain();
- sdvp.writeToParcel(sdvpParcel, 0);
- sdv.writeToParcel(sdvParcel, 0);
- assertThat(sdvpParcel.dataSize()).isEqualTo(sdvParcel.dataSize());
- }
-
- @Test
- public void testNullTupleArray() {
- int tupleField = 100; // atom id
-
- StatsDimensionsValueParcel parcel = new StatsDimensionsValueParcel();
- parcel.field = tupleField;
- parcel.valueType = StatsDimensionsValue.TUPLE_VALUE_TYPE;
- parcel.tupleValue = null;
-
- StatsDimensionsValue sdv = new StatsDimensionsValue(parcel);
- assertThat(sdv.getField()).isEqualTo(tupleField);
- assertThat(sdv.getValueType()).isEqualTo(StatsDimensionsValue.TUPLE_VALUE_TYPE);
- List<StatsDimensionsValue> sdvChildren = sdv.getTupleValueList();
- assertThat(sdvChildren.size()).isEqualTo(0);
- }
-}
diff --git a/apex/statsd/framework/test/src/android/util/StatsEventTest.java b/apex/statsd/framework/test/src/android/util/StatsEventTest.java
deleted file mode 100644
index 8d26369..0000000
--- a/apex/statsd/framework/test/src/android/util/StatsEventTest.java
+++ /dev/null
@@ -1,818 +0,0 @@
-/*
- * 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.util;
-
-import static com.google.common.truth.Truth.assertThat;
-import static com.google.common.truth.Truth.assertWithMessage;
-
-import static java.nio.charset.StandardCharsets.UTF_8;
-
-import android.os.SystemClock;
-
-import androidx.test.filters.SmallTest;
-import androidx.test.runner.AndroidJUnit4;
-
-import com.google.common.collect.Range;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.util.Random;
-
-/**
- * Internal tests for {@link StatsEvent}.
- */
-@SmallTest
-@RunWith(AndroidJUnit4.class)
-public class StatsEventTest {
-
- @Test
- public void testNoFields() {
- final long minTimestamp = SystemClock.elapsedRealtimeNanos();
- final StatsEvent statsEvent = StatsEvent.newBuilder().usePooledBuffer().build();
- final long maxTimestamp = SystemClock.elapsedRealtimeNanos();
-
- final int expectedAtomId = 0;
- assertThat(statsEvent.getAtomId()).isEqualTo(expectedAtomId);
-
- final ByteBuffer buffer =
- ByteBuffer.wrap(statsEvent.getBytes()).order(ByteOrder.LITTLE_ENDIAN);
-
- assertWithMessage("Root element in buffer is not TYPE_OBJECT")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_OBJECT);
-
- assertWithMessage("Incorrect number of elements in root object")
- .that(buffer.get()).isEqualTo(3);
-
- assertWithMessage("First element is not timestamp")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_LONG);
-
- assertWithMessage("Incorrect timestamp")
- .that(buffer.getLong()).isIn(Range.closed(minTimestamp, maxTimestamp));
-
- assertWithMessage("Second element is not atom id")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_INT);
-
- assertWithMessage("Incorrect atom id")
- .that(buffer.getInt()).isEqualTo(expectedAtomId);
-
- assertWithMessage("Third element is not errors type")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_ERRORS);
-
- final int errorMask = buffer.getInt();
-
- assertWithMessage("ERROR_NO_ATOM_ID should be the only error in the error mask")
- .that(errorMask).isEqualTo(StatsEvent.ERROR_NO_ATOM_ID);
-
- assertThat(statsEvent.getNumBytes()).isEqualTo(buffer.position());
-
- statsEvent.release();
- }
-
- @Test
- public void testOnlyAtomId() {
- final int expectedAtomId = 109;
-
- final long minTimestamp = SystemClock.elapsedRealtimeNanos();
- final StatsEvent statsEvent = StatsEvent.newBuilder()
- .setAtomId(expectedAtomId)
- .usePooledBuffer()
- .build();
- final long maxTimestamp = SystemClock.elapsedRealtimeNanos();
-
- assertThat(statsEvent.getAtomId()).isEqualTo(expectedAtomId);
-
- final ByteBuffer buffer =
- ByteBuffer.wrap(statsEvent.getBytes()).order(ByteOrder.LITTLE_ENDIAN);
-
- assertWithMessage("Root element in buffer is not TYPE_OBJECT")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_OBJECT);
-
- assertWithMessage("Incorrect number of elements in root object")
- .that(buffer.get()).isEqualTo(2);
-
- assertWithMessage("First element is not timestamp")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_LONG);
-
- assertWithMessage("Incorrect timestamp")
- .that(buffer.getLong()).isIn(Range.closed(minTimestamp, maxTimestamp));
-
- assertWithMessage("Second element is not atom id")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_INT);
-
- assertWithMessage("Incorrect atom id")
- .that(buffer.getInt()).isEqualTo(expectedAtomId);
-
- assertThat(statsEvent.getNumBytes()).isEqualTo(buffer.position());
-
- statsEvent.release();
- }
-
- @Test
- public void testIntBooleanIntInt() {
- final int expectedAtomId = 109;
- final int field1 = 1;
- final boolean field2 = true;
- final int field3 = 3;
- final int field4 = 4;
-
- final long minTimestamp = SystemClock.elapsedRealtimeNanos();
- final StatsEvent statsEvent = StatsEvent.newBuilder()
- .setAtomId(expectedAtomId)
- .writeInt(field1)
- .writeBoolean(field2)
- .writeInt(field3)
- .writeInt(field4)
- .usePooledBuffer()
- .build();
- final long maxTimestamp = SystemClock.elapsedRealtimeNanos();
-
- assertThat(statsEvent.getAtomId()).isEqualTo(expectedAtomId);
-
- final ByteBuffer buffer =
- ByteBuffer.wrap(statsEvent.getBytes()).order(ByteOrder.LITTLE_ENDIAN);
-
- assertWithMessage("Root element in buffer is not TYPE_OBJECT")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_OBJECT);
-
- assertWithMessage("Incorrect number of elements in root object")
- .that(buffer.get()).isEqualTo(6);
-
- assertWithMessage("First element is not timestamp")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_LONG);
-
- assertWithMessage("Incorrect timestamp")
- .that(buffer.getLong()).isIn(Range.closed(minTimestamp, maxTimestamp));
-
- assertWithMessage("Second element is not atom id")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_INT);
-
- assertWithMessage("Incorrect atom id")
- .that(buffer.getInt()).isEqualTo(expectedAtomId);
-
- assertWithMessage("First field is not Int")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_INT);
-
- assertWithMessage("Incorrect field 1")
- .that(buffer.getInt()).isEqualTo(field1);
-
- assertWithMessage("Second field is not Boolean")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_BOOLEAN);
-
- assertWithMessage("Incorrect field 2")
- .that(buffer.get()).isEqualTo(1);
-
- assertWithMessage("Third field is not Int")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_INT);
-
- assertWithMessage("Incorrect field 3")
- .that(buffer.getInt()).isEqualTo(field3);
-
- assertWithMessage("Fourth field is not Int")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_INT);
-
- assertWithMessage("Incorrect field 4")
- .that(buffer.getInt()).isEqualTo(field4);
-
- assertThat(statsEvent.getNumBytes()).isEqualTo(buffer.position());
-
- statsEvent.release();
- }
-
- @Test
- public void testStringFloatByteArray() {
- final int expectedAtomId = 109;
- final String field1 = "Str 1";
- final float field2 = 9.334f;
- final byte[] field3 = new byte[] { 56, 23, 89, -120 };
-
- final long minTimestamp = SystemClock.elapsedRealtimeNanos();
- final StatsEvent statsEvent = StatsEvent.newBuilder()
- .setAtomId(expectedAtomId)
- .writeString(field1)
- .writeFloat(field2)
- .writeByteArray(field3)
- .usePooledBuffer()
- .build();
- final long maxTimestamp = SystemClock.elapsedRealtimeNanos();
-
- assertThat(statsEvent.getAtomId()).isEqualTo(expectedAtomId);
-
- final ByteBuffer buffer =
- ByteBuffer.wrap(statsEvent.getBytes()).order(ByteOrder.LITTLE_ENDIAN);
-
- assertWithMessage("Root element in buffer is not TYPE_OBJECT")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_OBJECT);
-
- assertWithMessage("Incorrect number of elements in root object")
- .that(buffer.get()).isEqualTo(5);
-
- assertWithMessage("First element is not timestamp")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_LONG);
-
- assertWithMessage("Incorrect timestamp")
- .that(buffer.getLong()).isIn(Range.closed(minTimestamp, maxTimestamp));
-
- assertWithMessage("Second element is not atom id")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_INT);
-
- assertWithMessage("Incorrect atom id")
- .that(buffer.getInt()).isEqualTo(expectedAtomId);
-
- assertWithMessage("First field is not String")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_STRING);
-
- final String field1Actual = getStringFromByteBuffer(buffer);
- assertWithMessage("Incorrect field 1")
- .that(field1Actual).isEqualTo(field1);
-
- assertWithMessage("Second field is not Float")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_FLOAT);
-
- assertWithMessage("Incorrect field 2")
- .that(buffer.getFloat()).isEqualTo(field2);
-
- assertWithMessage("Third field is not byte array")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_BYTE_ARRAY);
-
- final byte[] field3Actual = getByteArrayFromByteBuffer(buffer);
- assertWithMessage("Incorrect field 3")
- .that(field3Actual).isEqualTo(field3);
-
- assertThat(statsEvent.getNumBytes()).isEqualTo(buffer.position());
-
- statsEvent.release();
- }
-
- @Test
- public void testAttributionChainLong() {
- final int expectedAtomId = 109;
- final int[] uids = new int[] { 1, 2, 3, 4, 5 };
- final String[] tags = new String[] { "1", "2", "3", "4", "5" };
- final long field2 = -230909823L;
-
- final long minTimestamp = SystemClock.elapsedRealtimeNanos();
- final StatsEvent statsEvent = StatsEvent.newBuilder()
- .setAtomId(expectedAtomId)
- .writeAttributionChain(uids, tags)
- .writeLong(field2)
- .usePooledBuffer()
- .build();
- final long maxTimestamp = SystemClock.elapsedRealtimeNanos();
-
- assertThat(statsEvent.getAtomId()).isEqualTo(expectedAtomId);
-
- final ByteBuffer buffer =
- ByteBuffer.wrap(statsEvent.getBytes()).order(ByteOrder.LITTLE_ENDIAN);
-
- assertWithMessage("Root element in buffer is not TYPE_OBJECT")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_OBJECT);
-
- assertWithMessage("Incorrect number of elements in root object")
- .that(buffer.get()).isEqualTo(4);
-
- assertWithMessage("First element is not timestamp")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_LONG);
-
- assertWithMessage("Incorrect timestamp")
- .that(buffer.getLong()).isIn(Range.closed(minTimestamp, maxTimestamp));
-
- assertWithMessage("Second element is not atom id")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_INT);
-
- assertWithMessage("Incorrect atom id")
- .that(buffer.getInt()).isEqualTo(expectedAtomId);
-
- assertWithMessage("First field is not Attribution Chain")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_ATTRIBUTION_CHAIN);
-
- assertWithMessage("Incorrect number of attribution nodes")
- .that(buffer.get()).isEqualTo((byte) uids.length);
-
- for (int i = 0; i < tags.length; i++) {
- assertWithMessage("Incorrect uid in Attribution Chain")
- .that(buffer.getInt()).isEqualTo(uids[i]);
-
- final String tag = getStringFromByteBuffer(buffer);
- assertWithMessage("Incorrect tag in Attribution Chain")
- .that(tag).isEqualTo(tags[i]);
- }
-
- assertWithMessage("Second field is not Long")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_LONG);
-
- assertWithMessage("Incorrect field 2")
- .that(buffer.getLong()).isEqualTo(field2);
-
- assertThat(statsEvent.getNumBytes()).isEqualTo(buffer.position());
-
- statsEvent.release();
- }
-
- @Test
- public void testKeyValuePairs() {
- final int expectedAtomId = 109;
- final SparseIntArray intMap = new SparseIntArray();
- final SparseLongArray longMap = new SparseLongArray();
- final SparseArray<String> stringMap = new SparseArray<>();
- final SparseArray<Float> floatMap = new SparseArray<>();
- intMap.put(1, -1);
- intMap.put(2, -2);
- stringMap.put(3, "abc");
- stringMap.put(4, "2h");
- floatMap.put(9, -234.344f);
-
- final long minTimestamp = SystemClock.elapsedRealtimeNanos();
- final StatsEvent statsEvent = StatsEvent.newBuilder()
- .setAtomId(expectedAtomId)
- .writeKeyValuePairs(intMap, longMap, stringMap, floatMap)
- .usePooledBuffer()
- .build();
- final long maxTimestamp = SystemClock.elapsedRealtimeNanos();
-
- assertThat(statsEvent.getAtomId()).isEqualTo(expectedAtomId);
-
- final ByteBuffer buffer =
- ByteBuffer.wrap(statsEvent.getBytes()).order(ByteOrder.LITTLE_ENDIAN);
-
- assertWithMessage("Root element in buffer is not TYPE_OBJECT")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_OBJECT);
-
- assertWithMessage("Incorrect number of elements in root object")
- .that(buffer.get()).isEqualTo(3);
-
- assertWithMessage("First element is not timestamp")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_LONG);
-
- assertWithMessage("Incorrect timestamp")
- .that(buffer.getLong()).isIn(Range.closed(minTimestamp, maxTimestamp));
-
- assertWithMessage("Second element is not atom id")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_INT);
-
- assertWithMessage("Incorrect atom id")
- .that(buffer.getInt()).isEqualTo(expectedAtomId);
-
- assertWithMessage("First field is not KeyValuePairs")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_KEY_VALUE_PAIRS);
-
- assertWithMessage("Incorrect number of key value pairs")
- .that(buffer.get()).isEqualTo(
- (byte) (intMap.size() + longMap.size() + stringMap.size()
- + floatMap.size()));
-
- for (int i = 0; i < intMap.size(); i++) {
- assertWithMessage("Incorrect key in intMap")
- .that(buffer.getInt()).isEqualTo(intMap.keyAt(i));
- assertWithMessage("The type id of the value should be TYPE_INT in intMap")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_INT);
- assertWithMessage("Incorrect value in intMap")
- .that(buffer.getInt()).isEqualTo(intMap.valueAt(i));
- }
-
- for (int i = 0; i < longMap.size(); i++) {
- assertWithMessage("Incorrect key in longMap")
- .that(buffer.getInt()).isEqualTo(longMap.keyAt(i));
- assertWithMessage("The type id of the value should be TYPE_LONG in longMap")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_LONG);
- assertWithMessage("Incorrect value in longMap")
- .that(buffer.getLong()).isEqualTo(longMap.valueAt(i));
- }
-
- for (int i = 0; i < stringMap.size(); i++) {
- assertWithMessage("Incorrect key in stringMap")
- .that(buffer.getInt()).isEqualTo(stringMap.keyAt(i));
- assertWithMessage("The type id of the value should be TYPE_STRING in stringMap")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_STRING);
- final String value = getStringFromByteBuffer(buffer);
- assertWithMessage("Incorrect value in stringMap")
- .that(value).isEqualTo(stringMap.valueAt(i));
- }
-
- for (int i = 0; i < floatMap.size(); i++) {
- assertWithMessage("Incorrect key in floatMap")
- .that(buffer.getInt()).isEqualTo(floatMap.keyAt(i));
- assertWithMessage("The type id of the value should be TYPE_FLOAT in floatMap")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_FLOAT);
- assertWithMessage("Incorrect value in floatMap")
- .that(buffer.getFloat()).isEqualTo(floatMap.valueAt(i));
- }
-
- assertThat(statsEvent.getNumBytes()).isEqualTo(buffer.position());
-
- statsEvent.release();
- }
-
- @Test
- public void testSingleAnnotations() {
- final int expectedAtomId = 109;
- final int field1 = 1;
- final byte field1AnnotationId = 45;
- final boolean field1AnnotationValue = false;
- final boolean field2 = true;
- final byte field2AnnotationId = 1;
- final int field2AnnotationValue = 23;
-
- final long minTimestamp = SystemClock.elapsedRealtimeNanos();
- final StatsEvent statsEvent = StatsEvent.newBuilder()
- .setAtomId(expectedAtomId)
- .writeInt(field1)
- .addBooleanAnnotation(field1AnnotationId, field1AnnotationValue)
- .writeBoolean(field2)
- .addIntAnnotation(field2AnnotationId, field2AnnotationValue)
- .usePooledBuffer()
- .build();
- final long maxTimestamp = SystemClock.elapsedRealtimeNanos();
-
- assertThat(statsEvent.getAtomId()).isEqualTo(expectedAtomId);
-
- final ByteBuffer buffer =
- ByteBuffer.wrap(statsEvent.getBytes()).order(ByteOrder.LITTLE_ENDIAN);
-
- assertWithMessage("Root element in buffer is not TYPE_OBJECT")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_OBJECT);
-
- assertWithMessage("Incorrect number of elements in root object")
- .that(buffer.get()).isEqualTo(4);
-
- assertWithMessage("First element is not timestamp")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_LONG);
-
- assertWithMessage("Incorrect timestamp")
- .that(buffer.getLong()).isIn(Range.closed(minTimestamp, maxTimestamp));
-
- assertWithMessage("Second element is not atom id")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_INT);
-
- assertWithMessage("Incorrect atom id")
- .that(buffer.getInt()).isEqualTo(expectedAtomId);
-
- final byte field1Header = buffer.get();
- final int field1AnnotationValueCount = field1Header >> 4;
- final byte field1Type = (byte) (field1Header & 0x0F);
- assertWithMessage("First field is not Int")
- .that(field1Type).isEqualTo(StatsEvent.TYPE_INT);
- assertWithMessage("First field annotation count is wrong")
- .that(field1AnnotationValueCount).isEqualTo(1);
- assertWithMessage("Incorrect field 1")
- .that(buffer.getInt()).isEqualTo(field1);
- assertWithMessage("First field's annotation id is wrong")
- .that(buffer.get()).isEqualTo(field1AnnotationId);
- assertWithMessage("First field's annotation type is wrong")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_BOOLEAN);
- assertWithMessage("First field's annotation value is wrong")
- .that(buffer.get()).isEqualTo(field1AnnotationValue ? 1 : 0);
-
- final byte field2Header = buffer.get();
- final int field2AnnotationValueCount = field2Header >> 4;
- final byte field2Type = (byte) (field2Header & 0x0F);
- assertWithMessage("Second field is not boolean")
- .that(field2Type).isEqualTo(StatsEvent.TYPE_BOOLEAN);
- assertWithMessage("Second field annotation count is wrong")
- .that(field2AnnotationValueCount).isEqualTo(1);
- assertWithMessage("Incorrect field 2")
- .that(buffer.get()).isEqualTo(field2 ? 1 : 0);
- assertWithMessage("Second field's annotation id is wrong")
- .that(buffer.get()).isEqualTo(field2AnnotationId);
- assertWithMessage("Second field's annotation type is wrong")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_INT);
- assertWithMessage("Second field's annotation value is wrong")
- .that(buffer.getInt()).isEqualTo(field2AnnotationValue);
-
- assertThat(statsEvent.getNumBytes()).isEqualTo(buffer.position());
-
- statsEvent.release();
- }
-
- @Test
- public void testAtomIdAnnotations() {
- final int expectedAtomId = 109;
- final byte atomAnnotationId = 84;
- final int atomAnnotationValue = 9;
- final int field1 = 1;
- final byte field1AnnotationId = 45;
- final boolean field1AnnotationValue = false;
- final boolean field2 = true;
- final byte field2AnnotationId = 1;
- final int field2AnnotationValue = 23;
-
- final long minTimestamp = SystemClock.elapsedRealtimeNanos();
- final StatsEvent statsEvent = StatsEvent.newBuilder()
- .setAtomId(expectedAtomId)
- .addIntAnnotation(atomAnnotationId, atomAnnotationValue)
- .writeInt(field1)
- .addBooleanAnnotation(field1AnnotationId, field1AnnotationValue)
- .writeBoolean(field2)
- .addIntAnnotation(field2AnnotationId, field2AnnotationValue)
- .usePooledBuffer()
- .build();
- final long maxTimestamp = SystemClock.elapsedRealtimeNanos();
-
- assertThat(statsEvent.getAtomId()).isEqualTo(expectedAtomId);
-
- final ByteBuffer buffer =
- ByteBuffer.wrap(statsEvent.getBytes()).order(ByteOrder.LITTLE_ENDIAN);
-
- assertWithMessage("Root element in buffer is not TYPE_OBJECT")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_OBJECT);
-
- assertWithMessage("Incorrect number of elements in root object")
- .that(buffer.get()).isEqualTo(4);
-
- assertWithMessage("First element is not timestamp")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_LONG);
-
- assertWithMessage("Incorrect timestamp")
- .that(buffer.getLong()).isIn(Range.closed(minTimestamp, maxTimestamp));
-
- final byte atomIdHeader = buffer.get();
- final int atomIdAnnotationValueCount = atomIdHeader >> 4;
- final byte atomIdValueType = (byte) (atomIdHeader & 0x0F);
- assertWithMessage("Second element is not atom id")
- .that(atomIdValueType).isEqualTo(StatsEvent.TYPE_INT);
- assertWithMessage("Atom id annotation count is wrong")
- .that(atomIdAnnotationValueCount).isEqualTo(1);
- assertWithMessage("Incorrect atom id")
- .that(buffer.getInt()).isEqualTo(expectedAtomId);
- assertWithMessage("Atom id's annotation id is wrong")
- .that(buffer.get()).isEqualTo(atomAnnotationId);
- assertWithMessage("Atom id's annotation type is wrong")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_INT);
- assertWithMessage("Atom id's annotation value is wrong")
- .that(buffer.getInt()).isEqualTo(atomAnnotationValue);
-
- final byte field1Header = buffer.get();
- final int field1AnnotationValueCount = field1Header >> 4;
- final byte field1Type = (byte) (field1Header & 0x0F);
- assertWithMessage("First field is not Int")
- .that(field1Type).isEqualTo(StatsEvent.TYPE_INT);
- assertWithMessage("First field annotation count is wrong")
- .that(field1AnnotationValueCount).isEqualTo(1);
- assertWithMessage("Incorrect field 1")
- .that(buffer.getInt()).isEqualTo(field1);
- assertWithMessage("First field's annotation id is wrong")
- .that(buffer.get()).isEqualTo(field1AnnotationId);
- assertWithMessage("First field's annotation type is wrong")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_BOOLEAN);
- assertWithMessage("First field's annotation value is wrong")
- .that(buffer.get()).isEqualTo(field1AnnotationValue ? 1 : 0);
-
- final byte field2Header = buffer.get();
- final int field2AnnotationValueCount = field2Header >> 4;
- final byte field2Type = (byte) (field2Header & 0x0F);
- assertWithMessage("Second field is not boolean")
- .that(field2Type).isEqualTo(StatsEvent.TYPE_BOOLEAN);
- assertWithMessage("Second field annotation count is wrong")
- .that(field2AnnotationValueCount).isEqualTo(1);
- assertWithMessage("Incorrect field 2")
- .that(buffer.get()).isEqualTo(field2 ? 1 : 0);
- assertWithMessage("Second field's annotation id is wrong")
- .that(buffer.get()).isEqualTo(field2AnnotationId);
- assertWithMessage("Second field's annotation type is wrong")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_INT);
- assertWithMessage("Second field's annotation value is wrong")
- .that(buffer.getInt()).isEqualTo(field2AnnotationValue);
-
- assertThat(statsEvent.getNumBytes()).isEqualTo(buffer.position());
-
- statsEvent.release();
- }
-
- @Test
- public void testSetAtomIdNotCalledImmediately() {
- final int expectedAtomId = 109;
- final int field1 = 25;
- final boolean field2 = true;
-
- final long minTimestamp = SystemClock.elapsedRealtimeNanos();
- final StatsEvent statsEvent = StatsEvent.newBuilder()
- .writeInt(field1)
- .setAtomId(expectedAtomId)
- .writeBoolean(field2)
- .usePooledBuffer()
- .build();
- final long maxTimestamp = SystemClock.elapsedRealtimeNanos();
-
- assertThat(statsEvent.getAtomId()).isEqualTo(expectedAtomId);
-
- final ByteBuffer buffer =
- ByteBuffer.wrap(statsEvent.getBytes()).order(ByteOrder.LITTLE_ENDIAN);
-
- assertWithMessage("Root element in buffer is not TYPE_OBJECT")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_OBJECT);
-
- assertWithMessage("Incorrect number of elements in root object")
- .that(buffer.get()).isEqualTo(3);
-
- assertWithMessage("First element is not timestamp")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_LONG);
-
- assertWithMessage("Incorrect timestamp")
- .that(buffer.getLong()).isIn(Range.closed(minTimestamp, maxTimestamp));
-
- assertWithMessage("Second element is not atom id")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_INT);
-
- assertWithMessage("Incorrect atom id")
- .that(buffer.getInt()).isEqualTo(expectedAtomId);
-
- assertWithMessage("Third element is not errors type")
- .that(buffer.get()).isEqualTo(StatsEvent.TYPE_ERRORS);
-
- final int errorMask = buffer.getInt();
-
- assertWithMessage("ERROR_ATOM_ID_INVALID_POSITION should be the only error in the mask")
- .that(errorMask).isEqualTo(StatsEvent.ERROR_ATOM_ID_INVALID_POSITION);
-
- assertThat(statsEvent.getNumBytes()).isEqualTo(buffer.position());
-
- statsEvent.release();
- }
-
- @Test
- public void testLargePulledEvent() {
- final int expectedAtomId = 10_020;
- byte[] field1 = new byte[10 * 1024];
- new Random().nextBytes(field1);
-
- final long minTimestamp = SystemClock.elapsedRealtimeNanos();
- final StatsEvent statsEvent =
- StatsEvent.newBuilder().setAtomId(expectedAtomId).writeByteArray(field1).build();
- final long maxTimestamp = SystemClock.elapsedRealtimeNanos();
-
- assertThat(statsEvent.getAtomId()).isEqualTo(expectedAtomId);
-
- final ByteBuffer buffer =
- ByteBuffer.wrap(statsEvent.getBytes()).order(ByteOrder.LITTLE_ENDIAN);
-
- assertWithMessage("Root element in buffer is not TYPE_OBJECT")
- .that(buffer.get())
- .isEqualTo(StatsEvent.TYPE_OBJECT);
-
- assertWithMessage("Incorrect number of elements in root object")
- .that(buffer.get())
- .isEqualTo(3);
-
- assertWithMessage("First element is not timestamp")
- .that(buffer.get())
- .isEqualTo(StatsEvent.TYPE_LONG);
-
- assertWithMessage("Incorrect timestamp")
- .that(buffer.getLong())
- .isIn(Range.closed(minTimestamp, maxTimestamp));
-
- assertWithMessage("Second element is not atom id")
- .that(buffer.get())
- .isEqualTo(StatsEvent.TYPE_INT);
-
- assertWithMessage("Incorrect atom id").that(buffer.getInt()).isEqualTo(expectedAtomId);
-
- assertWithMessage("Third element is not byte array")
- .that(buffer.get())
- .isEqualTo(StatsEvent.TYPE_BYTE_ARRAY);
-
- final byte[] field1Actual = getByteArrayFromByteBuffer(buffer);
- assertWithMessage("Incorrect field 1").that(field1Actual).isEqualTo(field1);
-
- assertThat(statsEvent.getNumBytes()).isEqualTo(buffer.position());
-
- statsEvent.release();
- }
-
- @Test
- public void testPulledEventOverflow() {
- final int expectedAtomId = 10_020;
- byte[] field1 = new byte[50 * 1024];
- new Random().nextBytes(field1);
-
- final long minTimestamp = SystemClock.elapsedRealtimeNanos();
- final StatsEvent statsEvent =
- StatsEvent.newBuilder().setAtomId(expectedAtomId).writeByteArray(field1).build();
- final long maxTimestamp = SystemClock.elapsedRealtimeNanos();
-
- assertThat(statsEvent.getAtomId()).isEqualTo(expectedAtomId);
-
- final ByteBuffer buffer =
- ByteBuffer.wrap(statsEvent.getBytes()).order(ByteOrder.LITTLE_ENDIAN);
-
- assertWithMessage("Root element in buffer is not TYPE_OBJECT")
- .that(buffer.get())
- .isEqualTo(StatsEvent.TYPE_OBJECT);
-
- assertWithMessage("Incorrect number of elements in root object")
- .that(buffer.get())
- .isEqualTo(3);
-
- assertWithMessage("First element is not timestamp")
- .that(buffer.get())
- .isEqualTo(StatsEvent.TYPE_LONG);
-
- assertWithMessage("Incorrect timestamp")
- .that(buffer.getLong())
- .isIn(Range.closed(minTimestamp, maxTimestamp));
-
- assertWithMessage("Second element is not atom id")
- .that(buffer.get())
- .isEqualTo(StatsEvent.TYPE_INT);
-
- assertWithMessage("Incorrect atom id").that(buffer.getInt()).isEqualTo(expectedAtomId);
-
- assertWithMessage("Third element is not errors type")
- .that(buffer.get())
- .isEqualTo(StatsEvent.TYPE_ERRORS);
-
- final int errorMask = buffer.getInt();
-
- assertWithMessage("ERROR_OVERFLOW should be the only error in the error mask")
- .that(errorMask)
- .isEqualTo(StatsEvent.ERROR_OVERFLOW);
-
- assertThat(statsEvent.getNumBytes()).isEqualTo(buffer.position());
-
- statsEvent.release();
- }
-
- @Test
- public void testPushedEventOverflow() {
- final int expectedAtomId = 10_020;
- byte[] field1 = new byte[10 * 1024];
- new Random().nextBytes(field1);
-
- final long minTimestamp = SystemClock.elapsedRealtimeNanos();
- final StatsEvent statsEvent = StatsEvent.newBuilder()
- .setAtomId(expectedAtomId)
- .writeByteArray(field1)
- .usePooledBuffer()
- .build();
- final long maxTimestamp = SystemClock.elapsedRealtimeNanos();
-
- assertThat(statsEvent.getAtomId()).isEqualTo(expectedAtomId);
-
- final ByteBuffer buffer =
- ByteBuffer.wrap(statsEvent.getBytes()).order(ByteOrder.LITTLE_ENDIAN);
-
- assertWithMessage("Root element in buffer is not TYPE_OBJECT")
- .that(buffer.get())
- .isEqualTo(StatsEvent.TYPE_OBJECT);
-
- assertWithMessage("Incorrect number of elements in root object")
- .that(buffer.get())
- .isEqualTo(3);
-
- assertWithMessage("First element is not timestamp")
- .that(buffer.get())
- .isEqualTo(StatsEvent.TYPE_LONG);
-
- assertWithMessage("Incorrect timestamp")
- .that(buffer.getLong())
- .isIn(Range.closed(minTimestamp, maxTimestamp));
-
- assertWithMessage("Second element is not atom id")
- .that(buffer.get())
- .isEqualTo(StatsEvent.TYPE_INT);
-
- assertWithMessage("Incorrect atom id").that(buffer.getInt()).isEqualTo(expectedAtomId);
-
- assertWithMessage("Third element is not errors type")
- .that(buffer.get())
- .isEqualTo(StatsEvent.TYPE_ERRORS);
-
- final int errorMask = buffer.getInt();
-
- assertWithMessage("ERROR_OVERFLOW should be the only error in the error mask")
- .that(errorMask)
- .isEqualTo(StatsEvent.ERROR_OVERFLOW);
-
- assertThat(statsEvent.getNumBytes()).isEqualTo(buffer.position());
-
- statsEvent.release();
- }
-
- private static byte[] getByteArrayFromByteBuffer(final ByteBuffer buffer) {
- final int numBytes = buffer.getInt();
- byte[] bytes = new byte[numBytes];
- buffer.get(bytes);
- return bytes;
- }
-
- private static String getStringFromByteBuffer(final ByteBuffer buffer) {
- final byte[] bytes = getByteArrayFromByteBuffer(buffer);
- return new String(bytes, UTF_8);
- }
-}
diff --git a/apex/statsd/jni/android_util_StatsLog.cpp b/apex/statsd/jni/android_util_StatsLog.cpp
deleted file mode 100644
index 71ce949..0000000
--- a/apex/statsd/jni/android_util_StatsLog.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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.
- */
-
-#define LOG_NAMESPACE "StatsLog.tag."
-#define LOG_TAG "StatsLog_println"
-
-#include <jni.h>
-#include <log/log.h>
-#include <nativehelper/scoped_local_ref.h>
-#include "stats_buffer_writer.h"
-
-namespace android {
-
-static void android_util_StatsLog_write(JNIEnv* env, jobject clazz, jbyteArray buf, jint size,
- jint atomId) {
- if (buf == NULL) {
- return;
- }
- jint actualSize = env->GetArrayLength(buf);
- if (actualSize < size) {
- return;
- }
-
- jbyte* bufferArray = env->GetByteArrayElements(buf, NULL);
- if (bufferArray == NULL) {
- return;
- }
-
- write_buffer_to_statsd((void*) bufferArray, size, atomId);
-
- env->ReleaseByteArrayElements(buf, bufferArray, 0);
-}
-
-/*
- * JNI registration.
- */
-static const JNINativeMethod gMethods[] = {
- /* name, signature, funcPtr */
- { "writeImpl", "([BII)V", (void*) android_util_StatsLog_write },
-};
-
-int register_android_util_StatsLog(JNIEnv* env)
-{
- static const char* kStatsLogClass = "android/util/StatsLog";
-
- ScopedLocalRef<jclass> cls(env, env->FindClass(kStatsLogClass));
- if (cls.get() == nullptr) {
- ALOGE("jni statsd registration failure, class not found '%s'", kStatsLogClass);
- return JNI_ERR;
- }
-
- const jint count = sizeof(gMethods) / sizeof(gMethods[0]);
- int status = env->RegisterNatives(cls.get(), gMethods, count);
- if (status < 0) {
- ALOGE("jni statsd registration failure, status: %d", status);
- return JNI_ERR;
- }
- return JNI_VERSION_1_4;
-}
-
-}; // namespace android
-
-/*
- * JNI Initialization
- */
-jint JNI_OnLoad(JavaVM* jvm, void* reserved) {
- JNIEnv* e;
-
- ALOGV("statsd : loading JNI\n");
- // Check JNI version
- if (jvm->GetEnv((void**)&e, JNI_VERSION_1_4)) {
- ALOGE("JNI version mismatch error");
- return JNI_ERR;
- }
-
- return android::register_android_util_StatsLog(e);
-}
diff --git a/apex/statsd/service/Android.bp b/apex/statsd/service/Android.bp
deleted file mode 100644
index df0ccfc..0000000
--- a/apex/statsd/service/Android.bp
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright (C) 2020 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.
-
-filegroup {
- name: "service-statsd-sources",
- srcs: [
- "java/**/*.java",
- ],
-}
-
-java_library {
- name: "service-statsd",
- srcs: [ ":service-statsd-sources" ],
- sdk_version: "system_server_current",
- libs: [
- "framework-annotations-lib",
- "framework-statsd",
- ],
- plugins: ["java_api_finder"],
- apex_available: [
- "com.android.os.statsd",
- "test_com.android.os.statsd",
- ],
-}
diff --git a/apex/statsd/service/java/com/android/server/stats/StatsCompanion.java b/apex/statsd/service/java/com/android/server/stats/StatsCompanion.java
deleted file mode 100644
index dc477a5..0000000
--- a/apex/statsd/service/java/com/android/server/stats/StatsCompanion.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * 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 com.android.server.stats;
-
-import android.app.PendingIntent;
-import android.app.StatsManager;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Binder;
-import android.os.IPendingIntentRef;
-import android.os.Process;
-import android.os.StatsDimensionsValue;
-import android.os.StatsDimensionsValueParcel;
-import android.util.Log;
-
-import com.android.server.SystemService;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-
-/**
- * @hide
- */
-public class StatsCompanion {
- private static final String TAG = "StatsCompanion";
- private static final boolean DEBUG = false;
-
- private static final int AID_STATSD = 1066;
-
- private static final String STATS_COMPANION_SERVICE = "statscompanion";
- private static final String STATS_MANAGER_SERVICE = "statsmanager";
-
- static void enforceStatsdCallingUid() {
- if (Binder.getCallingPid() == Process.myPid()) {
- return;
- }
- if (Binder.getCallingUid() != AID_STATSD) {
- throw new SecurityException("Not allowed to access StatsCompanion");
- }
- }
-
- /**
- * Lifecycle class for both {@link StatsCompanionService} and {@link StatsManagerService}.
- */
- public static final class Lifecycle extends SystemService {
- private StatsCompanionService mStatsCompanionService;
- private StatsManagerService mStatsManagerService;
-
- public Lifecycle(Context context) {
- super(context);
- }
-
- @Override
- public void onStart() {
- mStatsCompanionService = new StatsCompanionService(getContext());
- mStatsManagerService = new StatsManagerService(getContext());
- mStatsCompanionService.setStatsManagerService(mStatsManagerService);
- mStatsManagerService.setStatsCompanionService(mStatsCompanionService);
-
- try {
- publishBinderService(STATS_COMPANION_SERVICE, mStatsCompanionService);
- if (DEBUG) Log.d(TAG, "Published " + STATS_COMPANION_SERVICE);
- publishBinderService(STATS_MANAGER_SERVICE, mStatsManagerService);
- if (DEBUG) Log.d(TAG, "Published " + STATS_MANAGER_SERVICE);
- } catch (Exception e) {
- Log.e(TAG, "Failed to publishBinderService", e);
- }
- }
-
- @Override
- public void onBootPhase(int phase) {
- super.onBootPhase(phase);
- if (phase == PHASE_THIRD_PARTY_APPS_CAN_START) {
- mStatsCompanionService.systemReady();
- }
- if (phase == PHASE_BOOT_COMPLETED) {
- mStatsCompanionService.bootCompleted();
- }
- }
- }
-
- /**
- * Wrapper for {@link PendingIntent}. Allows Statsd to send PendingIntents.
- */
- public static class PendingIntentRef extends IPendingIntentRef.Stub {
-
- private static final String TAG = "PendingIntentRef";
-
- /**
- * The last report time is provided with each intent registered to
- * StatsManager#setFetchReportsOperation. This allows easy de-duping in the receiver if
- * statsd is requesting the client to retrieve the same statsd data. The last report time
- * corresponds to the last_report_elapsed_nanos that will provided in the current
- * ConfigMetricsReport, and this timestamp also corresponds to the
- * current_report_elapsed_nanos of the most recently obtained ConfigMetricsReport.
- */
- private static final String EXTRA_LAST_REPORT_TIME = "android.app.extra.LAST_REPORT_TIME";
- private static final int CODE_DATA_BROADCAST = 1;
- private static final int CODE_ACTIVE_CONFIGS_BROADCAST = 1;
- private static final int CODE_SUBSCRIBER_BROADCAST = 1;
-
- private final PendingIntent mPendingIntent;
- private final Context mContext;
-
- public PendingIntentRef(PendingIntent pendingIntent, Context context) {
- mPendingIntent = pendingIntent;
- mContext = context;
- }
-
- @Override
- public void sendDataBroadcast(long lastReportTimeNs) {
- enforceStatsdCallingUid();
- Intent intent = new Intent();
- intent.putExtra(EXTRA_LAST_REPORT_TIME, lastReportTimeNs);
- try {
- mPendingIntent.send(mContext, CODE_DATA_BROADCAST, intent, null, null);
- } catch (PendingIntent.CanceledException e) {
- Log.w(TAG, "Unable to send PendingIntent");
- }
- }
-
- @Override
- public void sendActiveConfigsChangedBroadcast(long[] configIds) {
- enforceStatsdCallingUid();
- Intent intent = new Intent();
- intent.putExtra(StatsManager.EXTRA_STATS_ACTIVE_CONFIG_KEYS, configIds);
- try {
- mPendingIntent.send(mContext, CODE_ACTIVE_CONFIGS_BROADCAST, intent, null, null);
- if (DEBUG) {
- Log.d(TAG, "Sent broadcast with config ids " + Arrays.toString(configIds));
- }
- } catch (PendingIntent.CanceledException e) {
- Log.w(TAG, "Unable to send active configs changed broadcast using PendingIntent");
- }
- }
-
- @Override
- public void sendSubscriberBroadcast(long configUid, long configId, long subscriptionId,
- long subscriptionRuleId, String[] cookies,
- StatsDimensionsValueParcel dimensionsValueParcel) {
- enforceStatsdCallingUid();
- StatsDimensionsValue dimensionsValue = new StatsDimensionsValue(dimensionsValueParcel);
- Intent intent =
- new Intent()
- .putExtra(StatsManager.EXTRA_STATS_CONFIG_UID, configUid)
- .putExtra(StatsManager.EXTRA_STATS_CONFIG_KEY, configId)
- .putExtra(StatsManager.EXTRA_STATS_SUBSCRIPTION_ID, subscriptionId)
- .putExtra(StatsManager.EXTRA_STATS_SUBSCRIPTION_RULE_ID,
- subscriptionRuleId)
- .putExtra(StatsManager.EXTRA_STATS_DIMENSIONS_VALUE, dimensionsValue);
-
- ArrayList<String> cookieList = new ArrayList<>(cookies.length);
- cookieList.addAll(Arrays.asList(cookies));
- intent.putStringArrayListExtra(
- StatsManager.EXTRA_STATS_BROADCAST_SUBSCRIBER_COOKIES, cookieList);
-
- if (DEBUG) {
- Log.d(TAG,
- String.format(
- "Statsd sendSubscriberBroadcast with params {%d %d %d %d %s %s}",
- configUid, configId, subscriptionId, subscriptionRuleId,
- Arrays.toString(cookies),
- dimensionsValue));
- }
- try {
- mPendingIntent.send(mContext, CODE_SUBSCRIBER_BROADCAST, intent, null, null);
- } catch (PendingIntent.CanceledException e) {
- Log.w(TAG,
- "Unable to send using PendingIntent from uid " + configUid
- + "; presumably it had been cancelled.");
- }
- }
- }
-}
diff --git a/apex/statsd/service/java/com/android/server/stats/StatsCompanionService.java b/apex/statsd/service/java/com/android/server/stats/StatsCompanionService.java
deleted file mode 100644
index fbda86f..0000000
--- a/apex/statsd/service/java/com/android/server/stats/StatsCompanionService.java
+++ /dev/null
@@ -1,770 +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.stats;
-
-import static android.os.Process.THREAD_PRIORITY_BACKGROUND;
-
-import android.app.AlarmManager;
-import android.app.AlarmManager.OnAlarmListener;
-import android.app.StatsManager;
-import android.content.BroadcastReceiver;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.pm.PackageInfo;
-import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
-import android.os.Binder;
-import android.os.Bundle;
-import android.os.FileUtils;
-import android.os.Handler;
-import android.os.HandlerThread;
-import android.os.IBinder;
-import android.os.IStatsCompanionService;
-import android.os.IStatsd;
-import android.os.Looper;
-import android.os.ParcelFileDescriptor;
-import android.os.PowerManager;
-import android.os.RemoteException;
-import android.os.StatsFrameworkInitializer;
-import android.os.SystemClock;
-import android.os.UserHandle;
-import android.os.UserManager;
-import android.util.Log;
-import android.util.proto.ProtoOutputStream;
-
-import com.android.internal.annotations.GuardedBy;
-
-import java.io.File;
-import java.io.FileDescriptor;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-/**
- * Helper service for statsd (the native stats management service in cmds/statsd/).
- * Used for registering and receiving alarms on behalf of statsd.
- *
- * @hide
- */
-public class StatsCompanionService extends IStatsCompanionService.Stub {
-
- private static final long MILLIS_IN_A_DAY = TimeUnit.DAYS.toMillis(1);
-
- public static final String RESULT_RECEIVER_CONTROLLER_KEY = "controller_activity";
- public static final String CONFIG_DIR = "/data/misc/stats-service";
-
- static final String TAG = "StatsCompanionService";
- static final boolean DEBUG = false;
- /**
- * Hard coded field ids of frameworks/base/cmds/statsd/src/uid_data.proto
- * to be used in ProtoOutputStream.
- */
- private static final int APPLICATION_INFO_FIELD_ID = 1;
- private static final int UID_FIELD_ID = 1;
- private static final int VERSION_FIELD_ID = 2;
- private static final int VERSION_STRING_FIELD_ID = 3;
- private static final int PACKAGE_NAME_FIELD_ID = 4;
- private static final int INSTALLER_FIELD_ID = 5;
-
- public static final int DEATH_THRESHOLD = 10;
-
- static final class CompanionHandler extends Handler {
- CompanionHandler(Looper looper) {
- super(looper);
- }
- }
-
- private final Context mContext;
- private final AlarmManager mAlarmManager;
- @GuardedBy("sStatsdLock")
- private static IStatsd sStatsd;
- private static final Object sStatsdLock = new Object();
-
- private final OnAlarmListener mPullingAlarmListener;
- private final OnAlarmListener mPeriodicAlarmListener;
-
- private StatsManagerService mStatsManagerService;
-
- @GuardedBy("sStatsdLock")
- private final HashSet<Long> mDeathTimeMillis = new HashSet<>();
- @GuardedBy("sStatsdLock")
- private final HashMap<Long, String> mDeletedFiles = new HashMap<>();
- private final CompanionHandler mHandler;
-
- // Flag that is set when PHASE_BOOT_COMPLETED is triggered in the StatsCompanion lifecycle.
- private AtomicBoolean mBootCompleted = new AtomicBoolean(false);
-
- public StatsCompanionService(Context context) {
- super();
- mContext = context;
- mAlarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE);
- if (DEBUG) Log.d(TAG, "Registered receiver for ACTION_PACKAGE_REPLACED and ADDED.");
- HandlerThread handlerThread = new HandlerThread(TAG);
- handlerThread.start();
- mHandler = new CompanionHandler(handlerThread.getLooper());
-
- mPullingAlarmListener = new PullingAlarmListener(context);
- mPeriodicAlarmListener = new PeriodicAlarmListener(context);
- }
-
- private final static int[] toIntArray(List<Integer> list) {
- int[] ret = new int[list.size()];
- for (int i = 0; i < ret.length; i++) {
- ret[i] = list.get(i);
- }
- return ret;
- }
-
- private final static long[] toLongArray(List<Long> list) {
- long[] ret = new long[list.size()];
- for (int i = 0; i < ret.length; i++) {
- ret[i] = list.get(i);
- }
- return ret;
- }
-
- /**
- * Non-blocking call to retrieve a reference to statsd
- *
- * @return IStatsd object if statsd is ready, null otherwise.
- */
- private static IStatsd getStatsdNonblocking() {
- synchronized (sStatsdLock) {
- return sStatsd;
- }
- }
-
- private static void informAllUids(Context context) {
- ParcelFileDescriptor[] fds;
- try {
- fds = ParcelFileDescriptor.createPipe();
- } catch (IOException e) {
- Log.e(TAG, "Failed to create a pipe to send uid map data.", e);
- return;
- }
- HandlerThread backgroundThread = new HandlerThread(
- "statsCompanionService.bg", THREAD_PRIORITY_BACKGROUND);
- backgroundThread.start();
- Handler handler = new Handler(backgroundThread.getLooper());
- handler.post(() -> {
- UserManager um = (UserManager) context.getSystemService(Context.USER_SERVICE);
- PackageManager pm = context.getPackageManager();
- final List<UserHandle> users = um.getUserHandles(true);
- if (DEBUG) {
- Log.d(TAG, "Iterating over " + users.size() + " userHandles.");
- }
- IStatsd statsd = getStatsdNonblocking();
- if (statsd == null) {
- return;
- }
- try {
- statsd.informAllUidData(fds[0]);
- } catch (RemoteException e) {
- Log.e(TAG, "Failed to send uid map to statsd");
- }
- try {
- fds[0].close();
- } catch (IOException e) {
- Log.e(TAG, "Failed to close the read side of the pipe.", e);
- }
- final ParcelFileDescriptor writeFd = fds[1];
- FileOutputStream fout = new ParcelFileDescriptor.AutoCloseOutputStream(writeFd);
- try {
- ProtoOutputStream output = new ProtoOutputStream(fout);
- int numRecords = 0;
- // Add in all the apps for every user/profile.
- for (UserHandle userHandle : users) {
- List<PackageInfo> packagesPlusApex = getAllPackagesWithApex(pm, userHandle);
- for (int j = 0; j < packagesPlusApex.size(); j++) {
- if (packagesPlusApex.get(j).applicationInfo != null) {
- String installer;
- try {
- installer = pm.getInstallerPackageName(
- packagesPlusApex.get(j).packageName);
- } catch (IllegalArgumentException e) {
- installer = "";
- }
- long applicationInfoToken =
- output.start(ProtoOutputStream.FIELD_TYPE_MESSAGE
- | ProtoOutputStream.FIELD_COUNT_REPEATED
- | APPLICATION_INFO_FIELD_ID);
- output.write(ProtoOutputStream.FIELD_TYPE_INT32
- | ProtoOutputStream.FIELD_COUNT_SINGLE | UID_FIELD_ID,
- packagesPlusApex.get(j).applicationInfo.uid);
- output.write(ProtoOutputStream.FIELD_TYPE_INT64
- | ProtoOutputStream.FIELD_COUNT_SINGLE
- | VERSION_FIELD_ID,
- packagesPlusApex.get(j).getLongVersionCode());
- output.write(ProtoOutputStream.FIELD_TYPE_STRING
- | ProtoOutputStream.FIELD_COUNT_SINGLE
- | VERSION_STRING_FIELD_ID,
- packagesPlusApex.get(j).versionName);
- output.write(ProtoOutputStream.FIELD_TYPE_STRING
- | ProtoOutputStream.FIELD_COUNT_SINGLE
- | PACKAGE_NAME_FIELD_ID, packagesPlusApex.get(j).packageName);
- output.write(ProtoOutputStream.FIELD_TYPE_STRING
- | ProtoOutputStream.FIELD_COUNT_SINGLE
- | INSTALLER_FIELD_ID,
- installer == null ? "" : installer);
- numRecords++;
- output.end(applicationInfoToken);
- }
- }
- }
- output.flush();
- if (DEBUG) {
- Log.d(TAG, "Sent data for " + numRecords + " apps");
- }
- } finally {
- FileUtils.closeQuietly(fout);
- backgroundThread.quit();
- backgroundThread.interrupt();
- }
- });
- }
-
- private static List<PackageInfo> getAllPackagesWithApex(PackageManager pm,
- UserHandle userHandle) {
- // We want all the uninstalled packages because uninstalled package uids can still be logged
- // to statsd.
- List<PackageInfo> allPackages = new ArrayList<>(
- pm.getInstalledPackagesAsUser(PackageManager.MATCH_UNINSTALLED_PACKAGES
- | PackageManager.MATCH_ANY_USER,
- userHandle.getIdentifier()));
- // We make a second query to package manager for the apex modules because package manager
- // returns both installed and uninstalled apexes with
- // PackageManager.MATCH_UNINSTALLED_PACKAGES flag. We only want active apexes because
- // inactive apexes can conflict with active ones.
- for (PackageInfo packageInfo : pm.getInstalledPackages(PackageManager.MATCH_APEX)) {
- if (packageInfo.isApex) {
- allPackages.add(packageInfo);
- }
- }
- return allPackages;
- }
-
- private static class WakelockThread extends Thread {
- private final PowerManager.WakeLock mWl;
- private final Runnable mRunnable;
-
- WakelockThread(Context context, String wakelockName, Runnable runnable) {
- PowerManager powerManager = (PowerManager)
- context.getSystemService(Context.POWER_SERVICE);
- mWl = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, wakelockName);
- mRunnable = runnable;
- }
- @Override
- public void run() {
- try {
- mRunnable.run();
- } finally {
- mWl.release();
- }
- }
- @Override
- public void start() {
- mWl.acquire();
- super.start();
- }
- }
-
- private final static class AppUpdateReceiver extends BroadcastReceiver {
- @Override
- public void onReceive(Context context, Intent intent) {
- /**
- * App updates actually consist of REMOVE, ADD, and then REPLACE broadcasts. To avoid
- * waste, we ignore the REMOVE and ADD broadcasts that contain the replacing flag.
- * If we can't find the value for EXTRA_REPLACING, we default to false.
- */
- if (!intent.getAction().equals(Intent.ACTION_PACKAGE_REPLACED)
- && intent.getBooleanExtra(Intent.EXTRA_REPLACING, false)) {
- return; // Keep only replacing or normal add and remove.
- }
- if (DEBUG) Log.d(TAG, "StatsCompanionService noticed an app was updated.");
- synchronized (sStatsdLock) {
- if (sStatsd == null) {
- Log.w(TAG, "Could not access statsd to inform it of an app update");
- return;
- }
- try {
- if (intent.getAction().equals(Intent.ACTION_PACKAGE_REMOVED)) {
- Bundle b = intent.getExtras();
- int uid = b.getInt(Intent.EXTRA_UID);
- boolean replacing = intent.getBooleanExtra(Intent.EXTRA_REPLACING, false);
- if (!replacing) {
- // Don't bother sending an update if we're right about to get another
- // intent for the new version that's added.
- String app = intent.getData().getSchemeSpecificPart();
- sStatsd.informOnePackageRemoved(app, uid);
- }
- } else {
- PackageManager pm = context.getPackageManager();
- Bundle b = intent.getExtras();
- int uid = b.getInt(Intent.EXTRA_UID);
- String app = intent.getData().getSchemeSpecificPart();
- PackageInfo pi = pm.getPackageInfo(app, PackageManager.MATCH_ANY_USER);
- String installer;
- try {
- installer = pm.getInstallerPackageName(app);
- } catch (IllegalArgumentException e) {
- installer = "";
- }
- sStatsd.informOnePackage(
- app,
- uid,
- pi.getLongVersionCode(),
- pi.versionName == null ? "" : pi.versionName,
- installer == null ? "" : installer);
- }
- } catch (Exception e) {
- Log.w(TAG, "Failed to inform statsd of an app update", e);
- }
- }
- }
- }
-
- private static final class UserUpdateReceiver extends BroadcastReceiver {
- @Override
- public void onReceive(Context context, Intent intent) {
- // Pull the latest state of UID->app name, version mapping.
- // Needed since the new user basically has a version of every app.
- informAllUids(context);
- }
- }
-
- public final static class PullingAlarmListener implements OnAlarmListener {
- private final Context mContext;
-
- PullingAlarmListener(Context context) {
- mContext = context;
- }
-
- @Override
- public void onAlarm() {
- if (DEBUG) {
- Log.d(TAG, "Time to poll something.");
- }
- IStatsd statsd = getStatsdNonblocking();
- if (statsd == null) {
- Log.w(TAG, "Could not access statsd to inform it of pulling alarm firing.");
- return;
- }
-
- // Wakelock needs to be retained while calling statsd.
- Thread thread = new WakelockThread(mContext,
- PullingAlarmListener.class.getCanonicalName(), new Runnable() {
- @Override
- public void run() {
- try {
- statsd.informPollAlarmFired();
- } catch (RemoteException e) {
- Log.w(TAG, "Failed to inform statsd of pulling alarm firing.", e);
- }
- }
- });
- thread.start();
- }
- }
-
- public final static class PeriodicAlarmListener implements OnAlarmListener {
- private final Context mContext;
-
- PeriodicAlarmListener(Context context) {
- mContext = context;
- }
-
- @Override
- public void onAlarm() {
- if (DEBUG) {
- Log.d(TAG, "Time to trigger periodic alarm.");
- }
- IStatsd statsd = getStatsdNonblocking();
- if (statsd == null) {
- Log.w(TAG, "Could not access statsd to inform it of periodic alarm firing.");
- return;
- }
-
- // Wakelock needs to be retained while calling statsd.
- Thread thread = new WakelockThread(mContext,
- PeriodicAlarmListener.class.getCanonicalName(), new Runnable() {
- @Override
- public void run() {
- try {
- statsd.informAlarmForSubscriberTriggeringFired();
- } catch (RemoteException e) {
- Log.w(TAG, "Failed to inform statsd of periodic alarm firing.", e);
- }
- }
- });
- thread.start();
- }
- }
-
- public final static class ShutdownEventReceiver extends BroadcastReceiver {
- @Override
- public void onReceive(Context context, Intent intent) {
- /**
- * Skip immediately if intent is not relevant to device shutdown.
- */
- if (!intent.getAction().equals(Intent.ACTION_REBOOT)
- && !(intent.getAction().equals(Intent.ACTION_SHUTDOWN)
- && (intent.getFlags() & Intent.FLAG_RECEIVER_FOREGROUND) != 0)) {
- return;
- }
-
- if (DEBUG) {
- Log.i(TAG, "StatsCompanionService noticed a shutdown.");
- }
- IStatsd statsd = getStatsdNonblocking();
- if (statsd == null) {
- Log.w(TAG, "Could not access statsd to inform it of a shutdown event.");
- return;
- }
- try {
- // two way binder call
- statsd.informDeviceShutdown();
- } catch (Exception e) {
- Log.w(TAG, "Failed to inform statsd of a shutdown event.", e);
- }
- }
- }
-
- @Override // Binder call
- public void setAlarmForSubscriberTriggering(long timestampMs) {
- StatsCompanion.enforceStatsdCallingUid();
- if (DEBUG) {
- Log.d(TAG,
- "Setting periodic alarm in about " + (timestampMs
- - SystemClock.elapsedRealtime()));
- }
- final long callingToken = Binder.clearCallingIdentity();
- try {
- // using ELAPSED_REALTIME, not ELAPSED_REALTIME_WAKEUP, so if device is asleep, will
- // only fire when it awakens.
- mAlarmManager.setExact(AlarmManager.ELAPSED_REALTIME, timestampMs, TAG + ".periodic",
- mPeriodicAlarmListener, mHandler);
- } finally {
- Binder.restoreCallingIdentity(callingToken);
- }
- }
-
- @Override // Binder call
- public void cancelAlarmForSubscriberTriggering() {
- StatsCompanion.enforceStatsdCallingUid();
- if (DEBUG) {
- Log.d(TAG, "Cancelling periodic alarm");
- }
- final long callingToken = Binder.clearCallingIdentity();
- try {
- mAlarmManager.cancel(mPeriodicAlarmListener);
- } finally {
- Binder.restoreCallingIdentity(callingToken);
- }
- }
-
- @Override // Binder call
- public void setPullingAlarm(long nextPullTimeMs) {
- StatsCompanion.enforceStatsdCallingUid();
- if (DEBUG) {
- Log.d(TAG, "Setting pulling alarm in about "
- + (nextPullTimeMs - SystemClock.elapsedRealtime()));
- }
- final long callingToken = Binder.clearCallingIdentity();
- try {
- // using ELAPSED_REALTIME, not ELAPSED_REALTIME_WAKEUP, so if device is asleep, will
- // only fire when it awakens.
- mAlarmManager.setExact(AlarmManager.ELAPSED_REALTIME, nextPullTimeMs, TAG + ".pull",
- mPullingAlarmListener, mHandler);
- } finally {
- Binder.restoreCallingIdentity(callingToken);
- }
- }
-
- @Override // Binder call
- public void cancelPullingAlarm() {
- StatsCompanion.enforceStatsdCallingUid();
- if (DEBUG) {
- Log.d(TAG, "Cancelling pulling alarm");
- }
- final long callingToken = Binder.clearCallingIdentity();
- try {
- mAlarmManager.cancel(mPullingAlarmListener);
- } finally {
- Binder.restoreCallingIdentity(callingToken);
- }
- }
-
- @Override // Binder call
- public void statsdReady() {
- StatsCompanion.enforceStatsdCallingUid();
- if (DEBUG) {
- Log.d(TAG, "learned that statsdReady");
- }
- sayHiToStatsd(); // tell statsd that we're ready too and link to it
-
- final Intent intent = new Intent(StatsManager.ACTION_STATSD_STARTED);
- // Retrieve list of broadcast receivers for this broadcast & send them directed broadcasts
- // to wake them up (if they're in background).
- List<ResolveInfo> resolveInfos =
- mContext.getPackageManager().queryBroadcastReceiversAsUser(
- intent, 0, UserHandle.SYSTEM);
- if (resolveInfos == null || resolveInfos.isEmpty()) {
- return; // No need to send broadcast.
- }
-
- for (ResolveInfo resolveInfo : resolveInfos) {
- Intent intentToSend = new Intent(intent);
- intentToSend.setComponent(new ComponentName(
- resolveInfo.activityInfo.applicationInfo.packageName,
- resolveInfo.activityInfo.name));
- mContext.sendBroadcastAsUser(intentToSend, UserHandle.SYSTEM,
- android.Manifest.permission.DUMP);
- }
- }
-
- @Override // Binder call
- public boolean checkPermission(String permission, int pid, int uid) {
- StatsCompanion.enforceStatsdCallingUid();
- return mContext.checkPermission(permission, pid, uid) == PackageManager.PERMISSION_GRANTED;
- }
-
- // Statsd related code
-
- /**
- * Fetches the statsd IBinder service. This is a blocking call that always refetches statsd
- * instead of returning the cached sStatsd.
- * Note: This should only be called from {@link #sayHiToStatsd()}. All other clients should use
- * the cached sStatsd via {@link #getStatsdNonblocking()}.
- */
- private IStatsd fetchStatsdServiceLocked() {
- sStatsd = IStatsd.Stub.asInterface(StatsFrameworkInitializer
- .getStatsServiceManager()
- .getStatsdServiceRegisterer()
- .get());
- return sStatsd;
- }
-
- private void registerStatsdDeathRecipient(IStatsd statsd, List<BroadcastReceiver> receivers) {
- StatsdDeathRecipient deathRecipient = new StatsdDeathRecipient(statsd, receivers);
-
- try {
- statsd.asBinder().linkToDeath(deathRecipient, /*flags=*/0);
- } catch (RemoteException e) {
- Log.e(TAG, "linkToDeath (StatsdDeathRecipient) failed");
- // Statsd has already died. Unregister receivers ourselves.
- for (BroadcastReceiver receiver : receivers) {
- mContext.unregisterReceiver(receiver);
- }
- synchronized (sStatsdLock) {
- if (statsd == sStatsd) {
- statsdNotReadyLocked();
- }
- }
- }
- }
-
- /**
- * Now that the android system is ready, StatsCompanion is ready too, so inform statsd.
- */
- void systemReady() {
- if (DEBUG) Log.d(TAG, "Learned that systemReady");
- sayHiToStatsd();
- }
-
- void setStatsManagerService(StatsManagerService statsManagerService) {
- mStatsManagerService = statsManagerService;
- }
-
- /**
- * Tells statsd that statscompanion is ready. If the binder call returns, link to
- * statsd.
- */
- private void sayHiToStatsd() {
- IStatsd statsd;
- synchronized (sStatsdLock) {
- if (sStatsd != null && sStatsd.asBinder().isBinderAlive()) {
- Log.e(TAG, "statsd has already been fetched before",
- new IllegalStateException("IStatsd object should be null or dead"));
- return;
- }
- statsd = fetchStatsdServiceLocked();
- }
-
- if (statsd == null) {
- Log.i(TAG, "Could not yet find statsd to tell it that StatsCompanion is alive.");
- return;
- }
-
- // Cleann up from previous statsd - cancel any alarms that had been set. Do this here
- // instead of in binder death because statsd can come back and set different alarms, or not
- // want to set an alarm when it had been set. This guarantees that when we get a new statsd,
- // we cancel any alarms before it is able to set them.
- cancelPullingAlarm();
- cancelAlarmForSubscriberTriggering();
-
- if (DEBUG) Log.d(TAG, "Saying hi to statsd");
- mStatsManagerService.statsdReady(statsd);
- try {
- statsd.statsCompanionReady();
-
- BroadcastReceiver appUpdateReceiver = new AppUpdateReceiver();
- BroadcastReceiver userUpdateReceiver = new UserUpdateReceiver();
- BroadcastReceiver shutdownEventReceiver = new ShutdownEventReceiver();
-
- // Setup broadcast receiver for updates.
- IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_REPLACED);
- filter.addAction(Intent.ACTION_PACKAGE_ADDED);
- filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
- filter.addDataScheme("package");
- mContext.registerReceiverForAllUsers(appUpdateReceiver, filter, null, null);
-
- // Setup receiver for user initialize (which happens once for a new user)
- // and if a user is removed.
- filter = new IntentFilter(Intent.ACTION_USER_INITIALIZE);
- filter.addAction(Intent.ACTION_USER_REMOVED);
- mContext.registerReceiverForAllUsers(userUpdateReceiver, filter, null, null);
-
- // Setup receiver for device reboots or shutdowns.
- filter = new IntentFilter(Intent.ACTION_REBOOT);
- filter.addAction(Intent.ACTION_SHUTDOWN);
- mContext.registerReceiverForAllUsers(shutdownEventReceiver, filter, null, null);
-
- // Register death recipient.
- List<BroadcastReceiver> broadcastReceivers =
- List.of(appUpdateReceiver, userUpdateReceiver, shutdownEventReceiver);
- registerStatsdDeathRecipient(statsd, broadcastReceivers);
-
- // Tell statsd that boot has completed. The signal may have already been sent, but since
- // the signal-receiving function is idempotent, that's ok.
- if (mBootCompleted.get()) {
- statsd.bootCompleted();
- }
-
- // Pull the latest state of UID->app name, version mapping when statsd starts.
- informAllUids(mContext);
-
- Log.i(TAG, "Told statsd that StatsCompanionService is alive.");
- } catch (RemoteException e) {
- Log.e(TAG, "Failed to inform statsd that statscompanion is ready", e);
- }
- }
-
- private class StatsdDeathRecipient implements IBinder.DeathRecipient {
-
- private final IStatsd mStatsd;
- private final List<BroadcastReceiver> mReceiversToUnregister;
-
- StatsdDeathRecipient(IStatsd statsd, List<BroadcastReceiver> receivers) {
- mStatsd = statsd;
- mReceiversToUnregister = receivers;
- }
-
- // It is possible for binderDied to be called after a restarted statsd calls statsdReady,
- // but that's alright because the code does not assume an ordering of the two calls.
- @Override
- public void binderDied() {
- Log.i(TAG, "Statsd is dead - erase all my knowledge, except pullers");
- synchronized (sStatsdLock) {
- long now = SystemClock.elapsedRealtime();
- for (Long timeMillis : mDeathTimeMillis) {
- long ageMillis = now - timeMillis;
- if (ageMillis > MILLIS_IN_A_DAY) {
- mDeathTimeMillis.remove(timeMillis);
- }
- }
- for (Long timeMillis : mDeletedFiles.keySet()) {
- long ageMillis = now - timeMillis;
- if (ageMillis > MILLIS_IN_A_DAY * 7) {
- mDeletedFiles.remove(timeMillis);
- }
- }
- mDeathTimeMillis.add(now);
- if (mDeathTimeMillis.size() >= DEATH_THRESHOLD) {
- mDeathTimeMillis.clear();
- File[] configs = new File(CONFIG_DIR).listFiles();
- if (configs != null && configs.length > 0) {
- String fileName = configs[0].getName();
- if (configs[0].delete()) {
- mDeletedFiles.put(now, fileName);
- }
- }
- }
-
- // Unregister receivers on death because receivers can only be unregistered once.
- // Otherwise, an IllegalArgumentException is thrown.
- for (BroadcastReceiver receiver: mReceiversToUnregister) {
- mContext.unregisterReceiver(receiver);
- }
-
- // It's possible for statsd to have restarted and called statsdReady, causing a new
- // sStatsd binder object to be fetched, before the binderDied callback runs. Only
- // call #statsdNotReadyLocked if that hasn't happened yet.
- if (mStatsd == sStatsd) {
- statsdNotReadyLocked();
- }
- }
- }
- }
-
- private void statsdNotReadyLocked() {
- sStatsd = null;
- mStatsManagerService.statsdNotReady();
- }
-
- void bootCompleted() {
- mBootCompleted.set(true);
- IStatsd statsd = getStatsdNonblocking();
- if (statsd == null) {
- // Statsd is not yet ready.
- // Delay the boot completed ping to {@link #sayHiToStatsd()}
- return;
- }
- try {
- statsd.bootCompleted();
- } catch (RemoteException e) {
- Log.e(TAG, "Failed to notify statsd that boot completed");
- }
- }
-
- @Override
- protected void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
- if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP)
- != PackageManager.PERMISSION_GRANTED) {
- return;
- }
-
- synchronized (sStatsdLock) {
- writer.println("Number of configuration files deleted: " + mDeletedFiles.size());
- if (mDeletedFiles.size() > 0) {
- writer.println(" timestamp, deleted file name");
- }
- long lastBootMillis =
- SystemClock.currentThreadTimeMillis() - SystemClock.elapsedRealtime();
- for (Long elapsedMillis : mDeletedFiles.keySet()) {
- long deletionMillis = lastBootMillis + elapsedMillis;
- writer.println(" " + deletionMillis + ", " + mDeletedFiles.get(elapsedMillis));
- }
- }
- }
-}
diff --git a/apex/statsd/service/java/com/android/server/stats/StatsManagerService.java b/apex/statsd/service/java/com/android/server/stats/StatsManagerService.java
deleted file mode 100644
index 1e3846b..0000000
--- a/apex/statsd/service/java/com/android/server/stats/StatsManagerService.java
+++ /dev/null
@@ -1,668 +0,0 @@
-/*
- * 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 com.android.server.stats;
-
-import static com.android.server.stats.StatsCompanion.PendingIntentRef;
-
-import android.Manifest;
-import android.annotation.Nullable;
-import android.app.AppOpsManager;
-import android.app.PendingIntent;
-import android.content.Context;
-import android.os.Binder;
-import android.os.IPullAtomCallback;
-import android.os.IStatsManagerService;
-import android.os.IStatsd;
-import android.os.PowerManager;
-import android.os.Process;
-import android.os.RemoteException;
-import android.util.ArrayMap;
-import android.util.Log;
-
-import com.android.internal.annotations.GuardedBy;
-
-import java.util.Map;
-import java.util.Objects;
-
-/**
- * Service for {@link android.app.StatsManager}.
- *
- * @hide
- */
-public class StatsManagerService extends IStatsManagerService.Stub {
-
- private static final String TAG = "StatsManagerService";
- private static final boolean DEBUG = false;
-
- private static final int STATSD_TIMEOUT_MILLIS = 5000;
-
- private static final String USAGE_STATS_PERMISSION_OPS = "android:get_usage_stats";
-
- @GuardedBy("mLock")
- private IStatsd mStatsd;
- private final Object mLock = new Object();
-
- private StatsCompanionService mStatsCompanionService;
- private Context mContext;
-
- @GuardedBy("mLock")
- private ArrayMap<ConfigKey, PendingIntentRef> mDataFetchPirMap = new ArrayMap<>();
- @GuardedBy("mLock")
- private ArrayMap<Integer, PendingIntentRef> mActiveConfigsPirMap = new ArrayMap<>();
- @GuardedBy("mLock")
- private ArrayMap<ConfigKey, ArrayMap<Long, PendingIntentRef>> mBroadcastSubscriberPirMap =
- new ArrayMap<>();
-
- public StatsManagerService(Context context) {
- super();
- mContext = context;
- }
-
- private static class ConfigKey {
- private final int mUid;
- private final long mConfigId;
-
- ConfigKey(int uid, long configId) {
- mUid = uid;
- mConfigId = configId;
- }
-
- public int getUid() {
- return mUid;
- }
-
- public long getConfigId() {
- return mConfigId;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(mUid, mConfigId);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof ConfigKey) {
- ConfigKey other = (ConfigKey) obj;
- return this.mUid == other.getUid() && this.mConfigId == other.getConfigId();
- }
- return false;
- }
- }
-
- private static class PullerKey {
- private final int mUid;
- private final int mAtomTag;
-
- PullerKey(int uid, int atom) {
- mUid = uid;
- mAtomTag = atom;
- }
-
- public int getUid() {
- return mUid;
- }
-
- public int getAtom() {
- return mAtomTag;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(mUid, mAtomTag);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof PullerKey) {
- PullerKey other = (PullerKey) obj;
- return this.mUid == other.getUid() && this.mAtomTag == other.getAtom();
- }
- return false;
- }
- }
-
- private static class PullerValue {
- private final long mCoolDownMillis;
- private final long mTimeoutMillis;
- private final int[] mAdditiveFields;
- private final IPullAtomCallback mCallback;
-
- PullerValue(long coolDownMillis, long timeoutMillis, int[] additiveFields,
- IPullAtomCallback callback) {
- mCoolDownMillis = coolDownMillis;
- mTimeoutMillis = timeoutMillis;
- mAdditiveFields = additiveFields;
- mCallback = callback;
- }
-
- public long getCoolDownMillis() {
- return mCoolDownMillis;
- }
-
- public long getTimeoutMillis() {
- return mTimeoutMillis;
- }
-
- public int[] getAdditiveFields() {
- return mAdditiveFields;
- }
-
- public IPullAtomCallback getCallback() {
- return mCallback;
- }
- }
-
- private final ArrayMap<PullerKey, PullerValue> mPullers = new ArrayMap<>();
-
- @Override
- public void registerPullAtomCallback(int atomTag, long coolDownMillis, long timeoutMillis,
- int[] additiveFields, IPullAtomCallback pullerCallback) {
- enforceRegisterStatsPullAtomPermission();
- if (pullerCallback == null) {
- Log.w(TAG, "Puller callback is null for atom " + atomTag);
- return;
- }
- int callingUid = Binder.getCallingUid();
- PullerKey key = new PullerKey(callingUid, atomTag);
- PullerValue val =
- new PullerValue(coolDownMillis, timeoutMillis, additiveFields, pullerCallback);
-
- // Always cache the puller in StatsManagerService. If statsd is down, we will register the
- // puller when statsd comes back up.
- synchronized (mLock) {
- mPullers.put(key, val);
- }
-
- IStatsd statsd = getStatsdNonblocking();
- if (statsd == null) {
- return;
- }
-
- final long token = Binder.clearCallingIdentity();
- try {
- statsd.registerPullAtomCallback(callingUid, atomTag, coolDownMillis, timeoutMillis,
- additiveFields, pullerCallback);
- } catch (RemoteException e) {
- Log.e(TAG, "Failed to access statsd to register puller for atom " + atomTag);
- } finally {
- Binder.restoreCallingIdentity(token);
- }
- }
-
- @Override
- public void unregisterPullAtomCallback(int atomTag) {
- enforceRegisterStatsPullAtomPermission();
- int callingUid = Binder.getCallingUid();
- PullerKey key = new PullerKey(callingUid, atomTag);
-
- // Always remove the puller from StatsManagerService even if statsd is down. When statsd
- // comes back up, we will not re-register the removed puller.
- synchronized (mLock) {
- mPullers.remove(key);
- }
-
- IStatsd statsd = getStatsdNonblocking();
- if (statsd == null) {
- return;
- }
-
- final long token = Binder.clearCallingIdentity();
- try {
- statsd.unregisterPullAtomCallback(callingUid, atomTag);
- } catch (RemoteException e) {
- Log.e(TAG, "Failed to access statsd to unregister puller for atom " + atomTag);
- } finally {
- Binder.restoreCallingIdentity(token);
- }
- }
-
- @Override
- public void setDataFetchOperation(long configId, PendingIntent pendingIntent,
- String packageName) {
- enforceDumpAndUsageStatsPermission(packageName);
- int callingUid = Binder.getCallingUid();
- final long token = Binder.clearCallingIdentity();
- PendingIntentRef pir = new PendingIntentRef(pendingIntent, mContext);
- ConfigKey key = new ConfigKey(callingUid, configId);
- // We add the PIR to a map so we can reregister if statsd is unavailable.
- synchronized (mLock) {
- mDataFetchPirMap.put(key, pir);
- }
- try {
- IStatsd statsd = getStatsdNonblocking();
- if (statsd != null) {
- statsd.setDataFetchOperation(configId, pir, callingUid);
- }
- } catch (RemoteException e) {
- Log.e(TAG, "Failed to setDataFetchOperation with statsd");
- } finally {
- Binder.restoreCallingIdentity(token);
- }
- }
-
- @Override
- public void removeDataFetchOperation(long configId, String packageName) {
- enforceDumpAndUsageStatsPermission(packageName);
- int callingUid = Binder.getCallingUid();
- final long token = Binder.clearCallingIdentity();
- ConfigKey key = new ConfigKey(callingUid, configId);
- synchronized (mLock) {
- mDataFetchPirMap.remove(key);
- }
- try {
- IStatsd statsd = getStatsdNonblocking();
- if (statsd != null) {
- statsd.removeDataFetchOperation(configId, callingUid);
- }
- } catch (RemoteException e) {
- Log.e(TAG, "Failed to removeDataFetchOperation with statsd");
- } finally {
- Binder.restoreCallingIdentity(token);
- }
- }
-
- @Override
- public long[] setActiveConfigsChangedOperation(PendingIntent pendingIntent,
- String packageName) {
- enforceDumpAndUsageStatsPermission(packageName);
- int callingUid = Binder.getCallingUid();
- final long token = Binder.clearCallingIdentity();
- PendingIntentRef pir = new PendingIntentRef(pendingIntent, mContext);
- // We add the PIR to a map so we can reregister if statsd is unavailable.
- synchronized (mLock) {
- mActiveConfigsPirMap.put(callingUid, pir);
- }
- try {
- IStatsd statsd = getStatsdNonblocking();
- if (statsd != null) {
- return statsd.setActiveConfigsChangedOperation(pir, callingUid);
- }
- } catch (RemoteException e) {
- Log.e(TAG, "Failed to setActiveConfigsChangedOperation with statsd");
- } finally {
- Binder.restoreCallingIdentity(token);
- }
- return new long[] {};
- }
-
- @Override
- public void removeActiveConfigsChangedOperation(String packageName) {
- enforceDumpAndUsageStatsPermission(packageName);
- int callingUid = Binder.getCallingUid();
- final long token = Binder.clearCallingIdentity();
- synchronized (mLock) {
- mActiveConfigsPirMap.remove(callingUid);
- }
- try {
- IStatsd statsd = getStatsdNonblocking();
- if (statsd != null) {
- statsd.removeActiveConfigsChangedOperation(callingUid);
- }
- } catch (RemoteException e) {
- Log.e(TAG, "Failed to removeActiveConfigsChangedOperation with statsd");
- } finally {
- Binder.restoreCallingIdentity(token);
- }
- }
-
- @Override
- public void setBroadcastSubscriber(long configId, long subscriberId,
- PendingIntent pendingIntent, String packageName) {
- enforceDumpAndUsageStatsPermission(packageName);
- int callingUid = Binder.getCallingUid();
- final long token = Binder.clearCallingIdentity();
- PendingIntentRef pir = new PendingIntentRef(pendingIntent, mContext);
- ConfigKey key = new ConfigKey(callingUid, configId);
- // We add the PIR to a map so we can reregister if statsd is unavailable.
- synchronized (mLock) {
- ArrayMap<Long, PendingIntentRef> innerMap = mBroadcastSubscriberPirMap
- .getOrDefault(key, new ArrayMap<>());
- innerMap.put(subscriberId, pir);
- mBroadcastSubscriberPirMap.put(key, innerMap);
- }
- try {
- IStatsd statsd = getStatsdNonblocking();
- if (statsd != null) {
- statsd.setBroadcastSubscriber(
- configId, subscriberId, pir, callingUid);
- }
- } catch (RemoteException e) {
- Log.e(TAG, "Failed to setBroadcastSubscriber with statsd");
- } finally {
- Binder.restoreCallingIdentity(token);
- }
- }
-
- @Override
- public void unsetBroadcastSubscriber(long configId, long subscriberId, String packageName) {
- enforceDumpAndUsageStatsPermission(packageName);
- int callingUid = Binder.getCallingUid();
- final long token = Binder.clearCallingIdentity();
- ConfigKey key = new ConfigKey(callingUid, configId);
- synchronized (mLock) {
- ArrayMap<Long, PendingIntentRef> innerMap = mBroadcastSubscriberPirMap
- .getOrDefault(key, new ArrayMap<>());
- innerMap.remove(subscriberId);
- if (innerMap.isEmpty()) {
- mBroadcastSubscriberPirMap.remove(key);
- }
- }
- try {
- IStatsd statsd = getStatsdNonblocking();
- if (statsd != null) {
- statsd.unsetBroadcastSubscriber(configId, subscriberId, callingUid);
- }
- } catch (RemoteException e) {
- Log.e(TAG, "Failed to unsetBroadcastSubscriber with statsd");
- } finally {
- Binder.restoreCallingIdentity(token);
- }
- }
-
- @Override
- public long[] getRegisteredExperimentIds() throws IllegalStateException {
- enforceDumpAndUsageStatsPermission(null);
- final long token = Binder.clearCallingIdentity();
- try {
- IStatsd statsd = waitForStatsd();
- if (statsd != null) {
- return statsd.getRegisteredExperimentIds();
- }
- } catch (RemoteException e) {
- Log.e(TAG, "Failed to getRegisteredExperimentIds with statsd");
- throw new IllegalStateException(e.getMessage(), e);
- } finally {
- Binder.restoreCallingIdentity(token);
- }
- throw new IllegalStateException("Failed to connect to statsd to registerExperimentIds");
- }
-
- @Override
- public byte[] getMetadata(String packageName) throws IllegalStateException {
- enforceDumpAndUsageStatsPermission(packageName);
- final long token = Binder.clearCallingIdentity();
- try {
- IStatsd statsd = waitForStatsd();
- if (statsd != null) {
- return statsd.getMetadata();
- }
- } catch (RemoteException e) {
- Log.e(TAG, "Failed to getMetadata with statsd");
- throw new IllegalStateException(e.getMessage(), e);
- } finally {
- Binder.restoreCallingIdentity(token);
- }
- throw new IllegalStateException("Failed to connect to statsd to getMetadata");
- }
-
- @Override
- public byte[] getData(long key, String packageName) throws IllegalStateException {
- enforceDumpAndUsageStatsPermission(packageName);
- PowerManager powerManager = (PowerManager)
- mContext.getSystemService(Context.POWER_SERVICE);
- PowerManager.WakeLock wl = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
- /*tag=*/ StatsManagerService.class.getCanonicalName());
- int callingUid = Binder.getCallingUid();
- final long token = Binder.clearCallingIdentity();
- wl.acquire();
- try {
- IStatsd statsd = waitForStatsd();
- if (statsd != null) {
- return statsd.getData(key, callingUid);
- }
- } catch (RemoteException e) {
- Log.e(TAG, "Failed to getData with statsd");
- throw new IllegalStateException(e.getMessage(), e);
- } finally {
- wl.release();
- Binder.restoreCallingIdentity(token);
- }
- throw new IllegalStateException("Failed to connect to statsd to getData");
- }
-
- @Override
- public void addConfiguration(long configId, byte[] config, String packageName)
- throws IllegalStateException {
- enforceDumpAndUsageStatsPermission(packageName);
- int callingUid = Binder.getCallingUid();
- final long token = Binder.clearCallingIdentity();
- try {
- IStatsd statsd = waitForStatsd();
- if (statsd != null) {
- statsd.addConfiguration(configId, config, callingUid);
- return;
- }
- } catch (RemoteException e) {
- Log.e(TAG, "Failed to addConfiguration with statsd");
- throw new IllegalStateException(e.getMessage(), e);
- } finally {
- Binder.restoreCallingIdentity(token);
- }
- throw new IllegalStateException("Failed to connect to statsd to addConfig");
- }
-
- @Override
- public void removeConfiguration(long configId, String packageName)
- throws IllegalStateException {
- enforceDumpAndUsageStatsPermission(packageName);
- int callingUid = Binder.getCallingUid();
- final long token = Binder.clearCallingIdentity();
- try {
- IStatsd statsd = waitForStatsd();
- if (statsd != null) {
- statsd.removeConfiguration(configId, callingUid);
- return;
- }
- } catch (RemoteException e) {
- Log.e(TAG, "Failed to removeConfiguration with statsd");
- throw new IllegalStateException(e.getMessage(), e);
- } finally {
- Binder.restoreCallingIdentity(token);
- }
- throw new IllegalStateException("Failed to connect to statsd to removeConfig");
- }
-
- void setStatsCompanionService(StatsCompanionService statsCompanionService) {
- mStatsCompanionService = statsCompanionService;
- }
-
- /**
- * Checks that the caller has both DUMP and PACKAGE_USAGE_STATS permissions. Also checks that
- * the caller has USAGE_STATS_PERMISSION_OPS for the specified packageName if it is not null.
- *
- * @param packageName The packageName to check USAGE_STATS_PERMISSION_OPS.
- */
- private void enforceDumpAndUsageStatsPermission(@Nullable String packageName) {
- int callingUid = Binder.getCallingUid();
- int callingPid = Binder.getCallingPid();
-
- if (callingPid == Process.myPid()) {
- return;
- }
-
- mContext.enforceCallingPermission(Manifest.permission.DUMP, null);
- mContext.enforceCallingPermission(Manifest.permission.PACKAGE_USAGE_STATS, null);
-
- if (packageName == null) {
- return;
- }
- AppOpsManager appOpsManager = (AppOpsManager) mContext
- .getSystemService(Context.APP_OPS_SERVICE);
- switch (appOpsManager.noteOp(USAGE_STATS_PERMISSION_OPS,
- Binder.getCallingUid(), packageName, null, null)) {
- case AppOpsManager.MODE_ALLOWED:
- case AppOpsManager.MODE_DEFAULT:
- break;
- default:
- throw new SecurityException(
- String.format("UID %d / PID %d lacks app-op %s",
- callingUid, callingPid, USAGE_STATS_PERMISSION_OPS)
- );
- }
- }
-
- private void enforceRegisterStatsPullAtomPermission() {
- mContext.enforceCallingOrSelfPermission(
- android.Manifest.permission.REGISTER_STATS_PULL_ATOM,
- "Need REGISTER_STATS_PULL_ATOM permission.");
- }
-
-
- /**
- * Clients should call this if blocking until statsd to be ready is desired
- *
- * @return IStatsd object if statsd becomes ready within the timeout, null otherwise.
- */
- private IStatsd waitForStatsd() {
- synchronized (mLock) {
- if (mStatsd == null) {
- try {
- mLock.wait(STATSD_TIMEOUT_MILLIS);
- } catch (InterruptedException e) {
- Log.e(TAG, "wait for statsd interrupted");
- }
- }
- return mStatsd;
- }
- }
-
- /**
- * Clients should call this to receive a reference to statsd.
- *
- * @return IStatsd object if statsd is ready, null otherwise.
- */
- private IStatsd getStatsdNonblocking() {
- synchronized (mLock) {
- return mStatsd;
- }
- }
-
- /**
- * Called from {@link StatsCompanionService}.
- *
- * Tells StatsManagerService that Statsd is ready and updates
- * Statsd with the contents of our local cache.
- */
- void statsdReady(IStatsd statsd) {
- synchronized (mLock) {
- mStatsd = statsd;
- mLock.notify();
- }
- sayHiToStatsd(statsd);
- }
-
- /**
- * Called from {@link StatsCompanionService}.
- *
- * Tells StatsManagerService that Statsd is no longer ready
- * and we should no longer make binder calls with statsd.
- */
- void statsdNotReady() {
- synchronized (mLock) {
- mStatsd = null;
- }
- }
-
- private void sayHiToStatsd(IStatsd statsd) {
- if (statsd == null) {
- return;
- }
-
- final long token = Binder.clearCallingIdentity();
- try {
- registerAllPullers(statsd);
- registerAllDataFetchOperations(statsd);
- registerAllActiveConfigsChangedOperations(statsd);
- registerAllBroadcastSubscribers(statsd);
- } catch (RemoteException e) {
- Log.e(TAG, "StatsManager failed to (re-)register data with statsd");
- } finally {
- Binder.restoreCallingIdentity(token);
- }
- }
-
- // Pre-condition: the Binder calling identity has already been cleared
- private void registerAllPullers(IStatsd statsd) throws RemoteException {
- // Since we do not want to make an IPC with the lock held, we first create a copy of the
- // data with the lock held before iterating through the map.
- ArrayMap<PullerKey, PullerValue> pullersCopy;
- synchronized (mLock) {
- pullersCopy = new ArrayMap<>(mPullers);
- }
-
- for (Map.Entry<PullerKey, PullerValue> entry : pullersCopy.entrySet()) {
- PullerKey key = entry.getKey();
- PullerValue value = entry.getValue();
- statsd.registerPullAtomCallback(key.getUid(), key.getAtom(), value.getCoolDownMillis(),
- value.getTimeoutMillis(), value.getAdditiveFields(), value.getCallback());
- }
- statsd.allPullersFromBootRegistered();
- }
-
- // Pre-condition: the Binder calling identity has already been cleared
- private void registerAllDataFetchOperations(IStatsd statsd) throws RemoteException {
- // Since we do not want to make an IPC with the lock held, we first create a copy of the
- // data with the lock held before iterating through the map.
- ArrayMap<ConfigKey, PendingIntentRef> dataFetchCopy;
- synchronized (mLock) {
- dataFetchCopy = new ArrayMap<>(mDataFetchPirMap);
- }
-
- for (Map.Entry<ConfigKey, PendingIntentRef> entry : dataFetchCopy.entrySet()) {
- ConfigKey key = entry.getKey();
- statsd.setDataFetchOperation(key.getConfigId(), entry.getValue(), key.getUid());
- }
- }
-
- // Pre-condition: the Binder calling identity has already been cleared
- private void registerAllActiveConfigsChangedOperations(IStatsd statsd) throws RemoteException {
- // Since we do not want to make an IPC with the lock held, we first create a copy of the
- // data with the lock held before iterating through the map.
- ArrayMap<Integer, PendingIntentRef> activeConfigsChangedCopy;
- synchronized (mLock) {
- activeConfigsChangedCopy = new ArrayMap<>(mActiveConfigsPirMap);
- }
-
- for (Map.Entry<Integer, PendingIntentRef> entry : activeConfigsChangedCopy.entrySet()) {
- statsd.setActiveConfigsChangedOperation(entry.getValue(), entry.getKey());
- }
- }
-
- // Pre-condition: the Binder calling identity has already been cleared
- private void registerAllBroadcastSubscribers(IStatsd statsd) throws RemoteException {
- // Since we do not want to make an IPC with the lock held, we first create a deep copy of
- // the data with the lock held before iterating through the map.
- ArrayMap<ConfigKey, ArrayMap<Long, PendingIntentRef>> broadcastSubscriberCopy =
- new ArrayMap<>();
- synchronized (mLock) {
- for (Map.Entry<ConfigKey, ArrayMap<Long, PendingIntentRef>> entry :
- mBroadcastSubscriberPirMap.entrySet()) {
- broadcastSubscriberCopy.put(entry.getKey(), new ArrayMap(entry.getValue()));
- }
- }
-
- for (Map.Entry<ConfigKey, ArrayMap<Long, PendingIntentRef>> entry :
- mBroadcastSubscriberPirMap.entrySet()) {
- ConfigKey configKey = entry.getKey();
- for (Map.Entry<Long, PendingIntentRef> subscriberEntry : entry.getValue().entrySet()) {
- statsd.setBroadcastSubscriber(configKey.getConfigId(), subscriberEntry.getKey(),
- subscriberEntry.getValue(), configKey.getUid());
- }
- }
- }
-}
diff --git a/apex/statsd/statsd.rc b/apex/statsd/statsd.rc
deleted file mode 100644
index 605da2a..0000000
--- a/apex/statsd/statsd.rc
+++ /dev/null
@@ -1,20 +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.
-
-service statsd /apex/com.android.os.statsd/bin/statsd
- class main
- socket statsdw dgram+passcred 0222 statsd statsd
- user statsd
- group statsd log
- writepid /dev/cpuset/system-background/tasks
diff --git a/apex/statsd/testing/Android.bp b/apex/statsd/testing/Android.bp
deleted file mode 100644
index a9cd0cc..0000000
--- a/apex/statsd/testing/Android.bp
+++ /dev/null
@@ -1,25 +0,0 @@
-// 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.
-
-apex_test {
- name: "test_com.android.os.statsd",
- visibility: [
- "//system/apex/tests",
- ],
- defaults: ["com.android.os.statsd-defaults"],
- manifest: "test_manifest.json",
- file_contexts: ":com.android.os.statsd-file_contexts",
- // Test APEX, should never be installed
- installable: false,
-}
diff --git a/apex/statsd/testing/test_manifest.json b/apex/statsd/testing/test_manifest.json
deleted file mode 100644
index 57343d3e..0000000
--- a/apex/statsd/testing/test_manifest.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "name": "com.android.os.statsd",
- "version": 2147483647
-}
diff --git a/apex/statsd/tests/libstatspull/Android.bp b/apex/statsd/tests/libstatspull/Android.bp
deleted file mode 100644
index 05b3e04..0000000
--- a/apex/statsd/tests/libstatspull/Android.bp
+++ /dev/null
@@ -1,61 +0,0 @@
-// 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.
-
-android_test {
- name: "LibStatsPullTests",
- static_libs: [
- "androidx.test.rules",
- "platformprotoslite",
- "statsdprotolite",
- "truth-prebuilt",
- ],
- libs: [
- "android.test.runner.stubs",
- "android.test.base.stubs",
- ],
- jni_libs: [
- "libstatspull_testhelper",
- ],
- srcs: [
- "src/**/*.java",
- "protos/**/*.proto",
- ],
- test_suites: [
- "device-tests",
- "mts",
- ],
- platform_apis: true,
- privileged: true,
- certificate: "platform",
- compile_multilib: "both",
-}
-
-cc_library_shared {
- name: "libstatspull_testhelper",
- srcs: ["jni/stats_pull_helper.cpp"],
- cflags: [
- "-Wall",
- "-Werror",
- ],
- shared_libs: [
- "libbinder_ndk",
- "statsd-aidl-ndk_platform",
- ],
- static_libs: [
- "libstatspull_private",
- "libstatssocket_private",
- "libutils",
- "libcutils",
- ],
-}
diff --git a/apex/statsd/tests/libstatspull/AndroidManifest.xml b/apex/statsd/tests/libstatspull/AndroidManifest.xml
deleted file mode 100644
index 0c669b0..0000000
--- a/apex/statsd/tests/libstatspull/AndroidManifest.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (C) 2020 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.
- -->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.internal.os.statsd.libstats" >
-
-
- <uses-permission android:name="android.permission.DUMP" />
- <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" />
- <uses-permission android:name="android.permission.REGISTER_STATS_PULL_ATOM" />
-
- <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
- android:targetPackage="com.android.internal.os.statsd.libstats"
- android:label="Tests for libstatspull">
- </instrumentation>
-</manifest>
-
diff --git a/apex/statsd/tests/libstatspull/jni/stats_pull_helper.cpp b/apex/statsd/tests/libstatspull/jni/stats_pull_helper.cpp
deleted file mode 100644
index 166592d..0000000
--- a/apex/statsd/tests/libstatspull/jni/stats_pull_helper.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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.
- */
-
-#include <jni.h>
-#include <log/log.h>
-#include <stats_event.h>
-#include <stats_pull_atom_callback.h>
-
-#include <chrono>
-#include <thread>
-
-using std::this_thread::sleep_for;
-
-namespace {
-static int32_t sAtomTag;
-static int32_t sPullReturnVal;
-static int64_t sLatencyMillis;
-static int32_t sAtomsPerPull;
-static int32_t sNumPulls = 0;
-
-static AStatsManager_PullAtomCallbackReturn pullAtomCallback(int32_t atomTag, AStatsEventList* data,
- void* /*cookie*/) {
- sNumPulls++;
- sleep_for(std::chrono::milliseconds(sLatencyMillis));
- for (int i = 0; i < sAtomsPerPull; i++) {
- AStatsEvent* event = AStatsEventList_addStatsEvent(data);
- AStatsEvent_setAtomId(event, atomTag);
- AStatsEvent_writeInt64(event, (int64_t) sNumPulls);
- AStatsEvent_build(event);
- }
- return sPullReturnVal;
-}
-
-extern "C" JNIEXPORT void JNICALL
-Java_com_android_internal_os_statsd_libstats_LibStatsPullTests_setStatsPuller(
- JNIEnv* /*env*/, jobject /* this */, jint atomTag, jlong timeoutMillis,
- jlong coolDownMillis, jint pullRetVal, jlong latencyMillis, int atomsPerPull) {
- sAtomTag = atomTag;
- sPullReturnVal = pullRetVal;
- sLatencyMillis = latencyMillis;
- sAtomsPerPull = atomsPerPull;
- sNumPulls = 0;
- AStatsManager_PullAtomMetadata* metadata = AStatsManager_PullAtomMetadata_obtain();
- AStatsManager_PullAtomMetadata_setCoolDownMillis(metadata, coolDownMillis);
- AStatsManager_PullAtomMetadata_setTimeoutMillis(metadata, timeoutMillis);
-
- AStatsManager_setPullAtomCallback(sAtomTag, metadata, &pullAtomCallback, nullptr);
- AStatsManager_PullAtomMetadata_release(metadata);
-}
-
-extern "C" JNIEXPORT void JNICALL
-Java_com_android_internal_os_statsd_libstats_LibStatsPullTests_clearStatsPuller(JNIEnv* /*env*/,
- jobject /* this */,
- jint /*atomTag*/) {
- AStatsManager_clearPullAtomCallback(sAtomTag);
-}
-} // namespace
diff --git a/apex/statsd/tests/libstatspull/protos/test_atoms.proto b/apex/statsd/tests/libstatspull/protos/test_atoms.proto
deleted file mode 100644
index 56c1b53..0000000
--- a/apex/statsd/tests/libstatspull/protos/test_atoms.proto
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-syntax = "proto2";
-
-package com.android.internal.os.statsd.protos;
-
-option java_package = "com.android.internal.os.statsd.protos";
-option java_outer_classname = "TestAtoms";
-
-message PullCallbackAtomWrapper {
- optional PullCallbackAtom pull_callback_atom = 150030;
-}
-
-message PullCallbackAtom {
- optional int64 long_val = 1;
-}
-
-
-
diff --git a/apex/statsd/tests/libstatspull/src/com/android/internal/os/statsd/libstats/LibStatsPullTests.java b/apex/statsd/tests/libstatspull/src/com/android/internal/os/statsd/libstats/LibStatsPullTests.java
deleted file mode 100644
index 6108a32..0000000
--- a/apex/statsd/tests/libstatspull/src/com/android/internal/os/statsd/libstats/LibStatsPullTests.java
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
- * 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 com.android.internal.os.statsd.libstats;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import android.app.StatsManager;
-import android.content.Context;
-import android.util.Log;
-import android.util.StatsLog;
-
-import androidx.test.InstrumentationRegistry;
-import androidx.test.filters.MediumTest;
-import androidx.test.runner.AndroidJUnit4;
-
-import com.android.internal.os.StatsdConfigProto.AtomMatcher;
-import com.android.internal.os.StatsdConfigProto.FieldFilter;
-import com.android.internal.os.StatsdConfigProto.GaugeMetric;
-import com.android.internal.os.StatsdConfigProto.PullAtomPackages;
-import com.android.internal.os.StatsdConfigProto.SimpleAtomMatcher;
-import com.android.internal.os.StatsdConfigProto.StatsdConfig;
-import com.android.internal.os.StatsdConfigProto.TimeUnit;
-import com.android.internal.os.statsd.protos.TestAtoms;
-import com.android.os.AtomsProto.Atom;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.util.List;
-
-/**
- * Test puller registration.
- */
-@MediumTest
-@RunWith(AndroidJUnit4.class)
-public class LibStatsPullTests {
- private static final String LOG_TAG = LibStatsPullTests.class.getSimpleName();
- private static final int SHORT_SLEEP_MILLIS = 250;
- private static final int LONG_SLEEP_MILLIS = 1_000;
- private Context mContext;
- private static final int PULL_ATOM_TAG = 150030;
- private static final int APP_BREADCRUMB_LABEL = 3;
- private static int sPullReturnValue;
- private static long sConfigId;
- private static long sPullLatencyMillis;
- private static long sPullTimeoutMillis;
- private static long sCoolDownMillis;
- private static int sAtomsPerPull;
-
- static {
- System.loadLibrary("statspull_testhelper");
- }
-
- /**
- * Setup the tests. Initialize shared data.
- */
- @Before
- public void setup() {
- mContext = InstrumentationRegistry.getTargetContext();
- assertThat(InstrumentationRegistry.getInstrumentation()).isNotNull();
- sPullReturnValue = StatsManager.PULL_SUCCESS;
- sPullLatencyMillis = 0;
- sPullTimeoutMillis = 10_000L;
- sCoolDownMillis = 1_000L;
- sAtomsPerPull = 1;
- }
-
- /**
- * Teardown the tests.
- */
- @After
- public void tearDown() throws Exception {
- clearStatsPuller(PULL_ATOM_TAG);
- StatsManager statsManager = (StatsManager) mContext.getSystemService(
- Context.STATS_MANAGER);
- statsManager.removeConfig(sConfigId);
- }
-
- /**
- * Tests adding a puller callback and that pulls complete successfully.
- */
- @Test
- public void testPullAtomCallbackRegistration() throws Exception {
- StatsManager statsManager = (StatsManager) mContext.getSystemService(
- Context.STATS_MANAGER);
- // Upload a config that captures that pulled atom.
- createAndAddConfigToStatsd(statsManager);
-
- // Add the puller.
- setStatsPuller(PULL_ATOM_TAG, sPullTimeoutMillis, sCoolDownMillis, sPullReturnValue,
- sPullLatencyMillis, sAtomsPerPull);
- Thread.sleep(SHORT_SLEEP_MILLIS);
- StatsLog.logStart(APP_BREADCRUMB_LABEL);
- // Let the current bucket finish.
- Thread.sleep(LONG_SLEEP_MILLIS);
- List<Atom> data = StatsConfigUtils.getGaugeMetricDataList(statsManager, sConfigId);
- clearStatsPuller(PULL_ATOM_TAG);
- assertThat(data.size()).isEqualTo(1);
- TestAtoms.PullCallbackAtomWrapper atomWrapper = null;
- try {
- atomWrapper = TestAtoms.PullCallbackAtomWrapper.parser()
- .parseFrom(data.get(0).toByteArray());
- } catch (Exception e) {
- Log.e(LOG_TAG, "Failed to parse primitive atoms");
- }
- assertThat(atomWrapper).isNotNull();
- assertThat(atomWrapper.hasPullCallbackAtom()).isTrue();
- TestAtoms.PullCallbackAtom atom =
- atomWrapper.getPullCallbackAtom();
- assertThat(atom.getLongVal()).isEqualTo(1);
- }
-
- /**
- * Tests that a failed pull is skipped.
- */
- @Test
- public void testPullAtomCallbackFailure() throws Exception {
- StatsManager statsManager = (StatsManager) mContext.getSystemService(
- Context.STATS_MANAGER);
- createAndAddConfigToStatsd(statsManager);
- sPullReturnValue = StatsManager.PULL_SKIP;
- // Add the puller.
- setStatsPuller(PULL_ATOM_TAG, sPullTimeoutMillis, sCoolDownMillis, sPullReturnValue,
- sPullLatencyMillis, sAtomsPerPull);
- Thread.sleep(SHORT_SLEEP_MILLIS);
- StatsLog.logStart(APP_BREADCRUMB_LABEL);
- // Let the current bucket finish.
- Thread.sleep(LONG_SLEEP_MILLIS);
- List<Atom> data = StatsConfigUtils.getGaugeMetricDataList(statsManager, sConfigId);
- clearStatsPuller(PULL_ATOM_TAG);
- assertThat(data.size()).isEqualTo(0);
- }
-
- /**
- * Tests that a pull that times out is skipped.
- */
- @Test
- public void testPullAtomCallbackTimeout() throws Exception {
- StatsManager statsManager = (StatsManager) mContext.getSystemService(
- Context.STATS_MANAGER);
- createAndAddConfigToStatsd(statsManager);
- // The puller will sleep for 1.5 sec.
- sPullLatencyMillis = 1_500;
- // 1 second timeout
- sPullTimeoutMillis = 1_000;
-
- // Add the puller.
- setStatsPuller(PULL_ATOM_TAG, sPullTimeoutMillis, sCoolDownMillis, sPullReturnValue,
- sPullLatencyMillis, sAtomsPerPull);
- Thread.sleep(SHORT_SLEEP_MILLIS);
- StatsLog.logStart(APP_BREADCRUMB_LABEL);
- // Let the current bucket finish and the pull timeout.
- Thread.sleep(sPullLatencyMillis * 2);
- List<Atom> data = StatsConfigUtils.getGaugeMetricDataList(statsManager, sConfigId);
- clearStatsPuller(PULL_ATOM_TAG);
- assertThat(data.size()).isEqualTo(0);
- }
-
- /**
- * Tests that 2 pulls in quick succession use the cache instead of pulling again.
- */
- @Test
- public void testPullAtomCallbackCache() throws Exception {
- StatsManager statsManager = (StatsManager) mContext.getSystemService(
- Context.STATS_MANAGER);
- createAndAddConfigToStatsd(statsManager);
-
- // Set the cooldown to 10 seconds
- sCoolDownMillis = 10_000L;
- // Add the puller.
- setStatsPuller(PULL_ATOM_TAG, sPullTimeoutMillis, sCoolDownMillis, sPullReturnValue,
- sPullLatencyMillis, sAtomsPerPull);
-
- Thread.sleep(SHORT_SLEEP_MILLIS);
- StatsLog.logStart(APP_BREADCRUMB_LABEL);
- // Pull from cache.
- StatsLog.logStart(APP_BREADCRUMB_LABEL);
- Thread.sleep(LONG_SLEEP_MILLIS);
- List<Atom> data = StatsConfigUtils.getGaugeMetricDataList(statsManager, sConfigId);
- clearStatsPuller(PULL_ATOM_TAG);
- assertThat(data.size()).isEqualTo(2);
- for (int i = 0; i < data.size(); i++) {
- TestAtoms.PullCallbackAtomWrapper atomWrapper = null;
- try {
- atomWrapper = TestAtoms.PullCallbackAtomWrapper.parser()
- .parseFrom(data.get(i).toByteArray());
- } catch (Exception e) {
- Log.e(LOG_TAG, "Failed to parse primitive atoms");
- }
- assertThat(atomWrapper).isNotNull();
- assertThat(atomWrapper.hasPullCallbackAtom()).isTrue();
- TestAtoms.PullCallbackAtom atom =
- atomWrapper.getPullCallbackAtom();
- assertThat(atom.getLongVal()).isEqualTo(1);
- }
- }
-
- /**
- * Tests that a pull that returns 1000 stats events works properly.
- */
- @Test
- public void testPullAtomCallbackStress() throws Exception {
- StatsManager statsManager = (StatsManager) mContext.getSystemService(
- Context.STATS_MANAGER);
- // Upload a config that captures that pulled atom.
- createAndAddConfigToStatsd(statsManager);
- sAtomsPerPull = 1000;
- // Add the puller.
- setStatsPuller(PULL_ATOM_TAG, sPullTimeoutMillis, sCoolDownMillis, sPullReturnValue,
- sPullLatencyMillis, sAtomsPerPull);
-
- Thread.sleep(SHORT_SLEEP_MILLIS);
- StatsLog.logStart(APP_BREADCRUMB_LABEL);
- // Let the current bucket finish.
- Thread.sleep(LONG_SLEEP_MILLIS);
- List<Atom> data = StatsConfigUtils.getGaugeMetricDataList(statsManager, sConfigId);
- clearStatsPuller(PULL_ATOM_TAG);
- assertThat(data.size()).isEqualTo(sAtomsPerPull);
-
- for (int i = 0; i < data.size(); i++) {
- TestAtoms.PullCallbackAtomWrapper atomWrapper = null;
- try {
- atomWrapper = TestAtoms.PullCallbackAtomWrapper.parser()
- .parseFrom(data.get(i).toByteArray());
- } catch (Exception e) {
- Log.e(LOG_TAG, "Failed to parse primitive atoms");
- }
- assertThat(atomWrapper).isNotNull();
- assertThat(atomWrapper.hasPullCallbackAtom()).isTrue();
- TestAtoms.PullCallbackAtom atom =
- atomWrapper.getPullCallbackAtom();
- assertThat(atom.getLongVal()).isEqualTo(1);
- }
- }
-
- private void createAndAddConfigToStatsd(StatsManager statsManager) throws Exception {
- sConfigId = System.currentTimeMillis();
- long triggerMatcherId = sConfigId + 10;
- long pullerMatcherId = sConfigId + 11;
- long metricId = sConfigId + 100;
- StatsdConfig config = StatsConfigUtils.getSimpleTestConfig(sConfigId)
- .addAtomMatcher(
- StatsConfigUtils.getAppBreadcrumbMatcher(triggerMatcherId,
- APP_BREADCRUMB_LABEL))
- .addAtomMatcher(AtomMatcher.newBuilder()
- .setId(pullerMatcherId)
- .setSimpleAtomMatcher(SimpleAtomMatcher.newBuilder()
- .setAtomId(PULL_ATOM_TAG))
- )
- .addGaugeMetric(GaugeMetric.newBuilder()
- .setId(metricId)
- .setWhat(pullerMatcherId)
- .setTriggerEvent(triggerMatcherId)
- .setGaugeFieldsFilter(FieldFilter.newBuilder().setIncludeAll(true))
- .setBucket(TimeUnit.CTS)
- .setSamplingType(GaugeMetric.SamplingType.FIRST_N_SAMPLES)
- .setMaxNumGaugeAtomsPerBucket(1000)
- )
- .addPullAtomPackages(PullAtomPackages.newBuilder()
- .setAtomId(PULL_ATOM_TAG)
- .addPackages(LibStatsPullTests.class.getPackage().getName()))
- .build();
- statsManager.addConfig(sConfigId, config.toByteArray());
- assertThat(StatsConfigUtils.verifyValidConfigExists(statsManager, sConfigId)).isTrue();
- }
-
- private native void setStatsPuller(int atomTag, long timeoutMillis, long coolDownMillis,
- int pullReturnVal, long latencyMillis, int atomPerPull);
-
- private native void clearStatsPuller(int atomTag);
-}
-
diff --git a/apex/statsd/tests/libstatspull/src/com/android/internal/os/statsd/libstats/StatsConfigUtils.java b/apex/statsd/tests/libstatspull/src/com/android/internal/os/statsd/libstats/StatsConfigUtils.java
deleted file mode 100644
index b5afb94..0000000
--- a/apex/statsd/tests/libstatspull/src/com/android/internal/os/statsd/libstats/StatsConfigUtils.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * 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 com.android.internal.os.statsd.libstats;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import android.app.StatsManager;
-import android.util.Log;
-
-import com.android.internal.os.StatsdConfigProto.AtomMatcher;
-import com.android.internal.os.StatsdConfigProto.FieldValueMatcher;
-import com.android.internal.os.StatsdConfigProto.SimpleAtomMatcher;
-import com.android.internal.os.StatsdConfigProto.StatsdConfig;
-import com.android.os.AtomsProto.AppBreadcrumbReported;
-import com.android.os.AtomsProto.Atom;
-import com.android.os.StatsLog.ConfigMetricsReport;
-import com.android.os.StatsLog.ConfigMetricsReportList;
-import com.android.os.StatsLog.GaugeBucketInfo;
-import com.android.os.StatsLog.GaugeMetricData;
-import com.android.os.StatsLog.StatsLogReport;
-import com.android.os.StatsLog.StatsdStatsReport;
-import com.android.os.StatsLog.StatsdStatsReport.ConfigStats;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Util class for constructing statsd configs.
- */
-public class StatsConfigUtils {
- public static final String TAG = "statsd.StatsConfigUtils";
- public static final int SHORT_WAIT = 2_000; // 2 seconds.
-
- /**
- * @return An empty StatsdConfig in serialized proto format.
- */
- public static StatsdConfig.Builder getSimpleTestConfig(long configId) {
- return StatsdConfig.newBuilder().setId(configId)
- .addAllowedLogSource(StatsConfigUtils.class.getPackage().getName());
- }
-
-
- public static boolean verifyValidConfigExists(StatsManager statsManager, long configId) {
- StatsdStatsReport report = null;
- try {
- report = StatsdStatsReport.parser().parseFrom(statsManager.getStatsMetadata());
- } catch (Exception e) {
- Log.e(TAG, "getMetadata failed", e);
- }
- assertThat(report).isNotNull();
- boolean foundConfig = false;
- for (ConfigStats configStats : report.getConfigStatsList()) {
- if (configStats.getId() == configId && configStats.getIsValid()
- && configStats.getDeletionTimeSec() == 0) {
- foundConfig = true;
- }
- }
- return foundConfig;
- }
-
- public static AtomMatcher getAppBreadcrumbMatcher(long id, int label) {
- return AtomMatcher.newBuilder()
- .setId(id)
- .setSimpleAtomMatcher(
- SimpleAtomMatcher.newBuilder()
- .setAtomId(Atom.APP_BREADCRUMB_REPORTED_FIELD_NUMBER)
- .addFieldValueMatcher(FieldValueMatcher.newBuilder()
- .setField(AppBreadcrumbReported.LABEL_FIELD_NUMBER)
- .setEqInt(label)
- )
- )
- .build();
- }
-
- public static ConfigMetricsReport getConfigMetricsReport(StatsManager statsManager,
- long configId) {
- ConfigMetricsReportList reportList = null;
- try {
- reportList = ConfigMetricsReportList.parser()
- .parseFrom(statsManager.getReports(configId));
- } catch (Exception e) {
- Log.e(TAG, "getData failed", e);
- }
- assertThat(reportList).isNotNull();
- assertThat(reportList.getReportsCount()).isEqualTo(1);
- ConfigMetricsReport report = reportList.getReports(0);
- assertThat(report.getDumpReportReason())
- .isEqualTo(ConfigMetricsReport.DumpReportReason.GET_DATA_CALLED);
- return report;
-
- }
- public static List<Atom> getGaugeMetricDataList(ConfigMetricsReport report) {
- List<Atom> data = new ArrayList<>();
- for (StatsLogReport metric : report.getMetricsList()) {
- for (GaugeMetricData gaugeMetricData : metric.getGaugeMetrics().getDataList()) {
- for (GaugeBucketInfo bucketInfo : gaugeMetricData.getBucketInfoList()) {
- for (Atom atom : bucketInfo.getAtomList()) {
- data.add(atom);
- }
- }
- }
- }
- return data;
- }
-
- public static List<Atom> getGaugeMetricDataList(StatsManager statsManager, long configId) {
- ConfigMetricsReport report = getConfigMetricsReport(statsManager, configId);
- return getGaugeMetricDataList(report);
- }
-}
-
diff --git a/api/OWNERS b/api/OWNERS
new file mode 100644
index 0000000..88d0b61
--- /dev/null
+++ b/api/OWNERS
@@ -0,0 +1 @@
+per-file Android.bp = file:platform/build/soong:/OWNERS
diff --git a/cmds/am/OWNERS b/cmds/am/OWNERS
new file mode 100644
index 0000000..72c0a9e
--- /dev/null
+++ b/cmds/am/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/am/OWNERS
diff --git a/cmds/appops/OWNERS b/cmds/appops/OWNERS
new file mode 100644
index 0000000..999ea0e
--- /dev/null
+++ b/cmds/appops/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/permission/OWNERS
diff --git a/cmds/backup/OWNERS b/cmds/backup/OWNERS
new file mode 100644
index 0000000..d99779e
--- /dev/null
+++ b/cmds/backup/OWNERS
@@ -0,0 +1 @@
+include /services/backup/OWNERS
diff --git a/cmds/bmgr/OWNERS b/cmds/bmgr/OWNERS
new file mode 100644
index 0000000..d99779e
--- /dev/null
+++ b/cmds/bmgr/OWNERS
@@ -0,0 +1 @@
+include /services/backup/OWNERS
diff --git a/cmds/bu/OWNERS b/cmds/bu/OWNERS
new file mode 100644
index 0000000..d99779e
--- /dev/null
+++ b/cmds/bu/OWNERS
@@ -0,0 +1 @@
+include /services/backup/OWNERS
diff --git a/cmds/dpm/OWNERS b/cmds/dpm/OWNERS
new file mode 100644
index 0000000..e95633a
--- /dev/null
+++ b/cmds/dpm/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/app/admin/OWNERS
diff --git a/cmds/ime/OWNERS b/cmds/ime/OWNERS
new file mode 100644
index 0000000..5deb2ce
--- /dev/null
+++ b/cmds/ime/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/view/inputmethod/OWNERS
diff --git a/cmds/incident/OWNERS b/cmds/incident/OWNERS
new file mode 100644
index 0000000..f766115
--- /dev/null
+++ b/cmds/incident/OWNERS
@@ -0,0 +1 @@
+include /cmds/incidentd/OWNERS
diff --git a/cmds/input/OWNERS b/cmds/input/OWNERS
new file mode 100644
index 0000000..d701f23
--- /dev/null
+++ b/cmds/input/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/hardware/input/OWNERS
diff --git a/cmds/locksettings/OWNERS b/cmds/locksettings/OWNERS
new file mode 100644
index 0000000..0a8dc8c
--- /dev/null
+++ b/cmds/locksettings/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/locksettings/OWNERS
diff --git a/cmds/pm/OWNERS b/cmds/pm/OWNERS
new file mode 100644
index 0000000..d825dfd
--- /dev/null
+++ b/cmds/pm/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/pm/OWNERS
diff --git a/cmds/sm/OWNERS b/cmds/sm/OWNERS
new file mode 100644
index 0000000..6f9dbea
--- /dev/null
+++ b/cmds/sm/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/os/storage/OWNERS
diff --git a/cmds/telecom/OWNERS b/cmds/telecom/OWNERS
new file mode 100644
index 0000000..2f813e6
--- /dev/null
+++ b/cmds/telecom/OWNERS
@@ -0,0 +1 @@
+include /telecomm/OWNERS
diff --git a/cmds/uinput/OWNERS b/cmds/uinput/OWNERS
new file mode 100644
index 0000000..d701f23
--- /dev/null
+++ b/cmds/uinput/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/hardware/input/OWNERS
diff --git a/cmds/wm/OWNERS b/cmds/wm/OWNERS
new file mode 100644
index 0000000..0862c05
--- /dev/null
+++ b/cmds/wm/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/wm/OWNERS
diff --git a/config/OWNERS b/config/OWNERS
index 3d4924d..d59c6f2 100644
--- a/config/OWNERS
+++ b/config/OWNERS
@@ -1,4 +1,7 @@
+include /ZYGOTE_OWNERS
+
# compat-team@ for changes to hiddenapi files
+
per-file hiddenapi-* = [email protected], [email protected], [email protected]
# Escalations:
diff --git a/core/api/OWNERS b/core/api/OWNERS
new file mode 100644
index 0000000..0b95c51
--- /dev/null
+++ b/core/api/OWNERS
@@ -0,0 +1,2 @@
+# API changes are managed via Prolog rules, not OWNERS
+*
diff --git a/core/api/current.txt b/core/api/current.txt
index 14c1dc87..14a2772 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -165,6 +165,7 @@
field public static final String USE_BIOMETRIC = "android.permission.USE_BIOMETRIC";
field @Deprecated public static final String USE_FINGERPRINT = "android.permission.USE_FINGERPRINT";
field public static final String USE_FULL_SCREEN_INTENT = "android.permission.USE_FULL_SCREEN_INTENT";
+ field public static final String USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER = "android.permission.USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER";
field public static final String USE_SIP = "android.permission.USE_SIP";
field public static final String VIBRATE = "android.permission.VIBRATE";
field public static final String WAKE_LOCK = "android.permission.WAKE_LOCK";
@@ -6920,6 +6921,7 @@
method public int getGlobalPrivateDnsMode(@NonNull android.content.ComponentName);
method @NonNull public java.util.List<byte[]> getInstalledCaCerts(@Nullable android.content.ComponentName);
method @Nullable public java.util.List<java.lang.String> getKeepUninstalledPackages(@Nullable android.content.ComponentName);
+ method @NonNull public java.util.Set<java.util.Set<java.lang.String>> getKeyPairGrants(@NonNull String);
method public int getKeyguardDisabledFeatures(@Nullable android.content.ComponentName);
method public int getLockTaskFeatures(@NonNull android.content.ComponentName);
method @NonNull public String[] getLockTaskPackages(@NonNull android.content.ComponentName);
@@ -34862,6 +34864,27 @@
method public void onCancel();
}
+ public abstract class CombinedVibrationEffect implements android.os.Parcelable {
+ method @NonNull public static android.os.CombinedVibrationEffect createSynced(@NonNull android.os.VibrationEffect);
+ method public int describeContents();
+ method @NonNull public static android.os.CombinedVibrationEffect.SequentialCombination startSequential();
+ method @NonNull public static android.os.CombinedVibrationEffect.SyncedCombination startSynced();
+ field @NonNull public static final android.os.Parcelable.Creator<android.os.CombinedVibrationEffect> CREATOR;
+ }
+
+ public static final class CombinedVibrationEffect.SequentialCombination {
+ method @NonNull public android.os.CombinedVibrationEffect.SequentialCombination addNext(int, @NonNull android.os.VibrationEffect);
+ method @NonNull public android.os.CombinedVibrationEffect.SequentialCombination addNext(int, @NonNull android.os.VibrationEffect, int);
+ method @NonNull public android.os.CombinedVibrationEffect.SequentialCombination addNext(@NonNull android.os.CombinedVibrationEffect);
+ method @NonNull public android.os.CombinedVibrationEffect.SequentialCombination addNext(@NonNull android.os.CombinedVibrationEffect, int);
+ method @NonNull public android.os.CombinedVibrationEffect combine();
+ }
+
+ public static final class CombinedVibrationEffect.SyncedCombination {
+ method @NonNull public android.os.CombinedVibrationEffect.SyncedCombination addVibrator(int, @NonNull android.os.VibrationEffect);
+ method @NonNull public android.os.CombinedVibrationEffect combine();
+ }
+
public class ConditionVariable {
ctor public ConditionVariable();
ctor public ConditionVariable(boolean);
@@ -36088,6 +36111,13 @@
field public static final int VIBRATION_EFFECT_SUPPORT_YES = 1; // 0x1
}
+ public abstract class VibratorManager {
+ method @NonNull public abstract android.os.Vibrator getDefaultVibrator();
+ method @NonNull public abstract android.os.Vibrator getVibrator(int);
+ method @NonNull public abstract int[] getVibratorIds();
+ method public abstract void vibrate(@NonNull android.os.CombinedVibrationEffect);
+ }
+
public class WorkSource implements android.os.Parcelable {
ctor public WorkSource();
ctor public WorkSource(android.os.WorkSource);
@@ -47014,7 +47044,6 @@
method public boolean isVoicemailVibrationEnabled(android.telecom.PhoneAccountHandle);
method public boolean isWorldPhone();
method @Deprecated public void listen(android.telephony.PhoneStateListener, int);
- method @Deprecated public void listen(long, @NonNull android.telephony.PhoneStateListener);
method public void registerPhoneStateListener(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.PhoneStateListener);
method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public void requestCellInfoUpdate(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.TelephonyManager.CellInfoCallback);
method @RequiresPermission(allOf={android.Manifest.permission.MODIFY_PHONE_STATE, android.Manifest.permission.ACCESS_FINE_LOCATION}) public android.telephony.NetworkScan requestNetworkScan(android.telephony.NetworkScanRequest, java.util.concurrent.Executor, android.telephony.TelephonyScanManager.NetworkScanCallback);
@@ -51337,6 +51366,7 @@
method public int getSources();
method public int getVendorId();
method public android.os.Vibrator getVibrator();
+ method @NonNull public android.os.VibratorManager getVibratorManager();
method public boolean[] hasKeys(int...);
method public boolean hasMicrophone();
method public boolean isEnabled();
diff --git a/core/api/system-current.txt b/core/api/system-current.txt
index 7e12e2e..1d71726 100644
--- a/core/api/system-current.txt
+++ b/core/api/system-current.txt
@@ -4370,6 +4370,7 @@
field public static final int PLAYER_STATE_STARTED = 2; // 0x2
field public static final int PLAYER_STATE_STOPPED = 4; // 0x4
field public static final int PLAYER_STATE_UNKNOWN = -1; // 0xffffffff
+ field public static final int PLAYER_TYPE_AAUDIO = 13; // 0xd
field public static final int PLAYER_TYPE_JAM_AUDIOTRACK = 1; // 0x1
field public static final int PLAYER_TYPE_JAM_MEDIAPLAYER = 2; // 0x2
field public static final int PLAYER_TYPE_JAM_SOUNDPOOL = 3; // 0x3
@@ -5911,8 +5912,8 @@
public class DvbsFrontendSettings extends android.media.tv.tuner.frontend.FrontendSettings {
method @NonNull public static android.media.tv.tuner.frontend.DvbsFrontendSettings.Builder builder();
+ method public boolean canHandleDiseqcRxMessage();
method @Nullable public android.media.tv.tuner.frontend.DvbsCodeRate getCodeRate();
- method public boolean getCouldHandleDiseqcRxMessage();
method public int getInputStreamId();
method public int getModulation();
method public int getPilot();
@@ -5964,8 +5965,8 @@
public static class DvbsFrontendSettings.Builder {
method @NonNull public android.media.tv.tuner.frontend.DvbsFrontendSettings build();
+ method @NonNull public android.media.tv.tuner.frontend.DvbsFrontendSettings.Builder setCanHandleDiseqcRxMessage(boolean);
method @NonNull public android.media.tv.tuner.frontend.DvbsFrontendSettings.Builder setCodeRate(@Nullable android.media.tv.tuner.frontend.DvbsCodeRate);
- method @NonNull public android.media.tv.tuner.frontend.DvbsFrontendSettings.Builder setCouldHandleDiseqcRxMessage(boolean);
method @IntRange(from=1) @NonNull public android.media.tv.tuner.frontend.DvbsFrontendSettings.Builder setFrequency(int);
method @NonNull public android.media.tv.tuner.frontend.DvbsFrontendSettings.Builder setInputStreamId(int);
method @NonNull public android.media.tv.tuner.frontend.DvbsFrontendSettings.Builder setModulation(int);
@@ -11010,8 +11011,10 @@
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setRadio(boolean);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setRadioEnabled(boolean);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setRadioPower(boolean);
- method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setSimPowerState(int);
- method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setSimPowerStateForSlot(int, int);
+ method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setSimPowerState(int);
+ method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setSimPowerState(int, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>);
+ method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setSimPowerStateForSlot(int, int);
+ method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setSimPowerStateForSlot(int, int, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setSystemSelectionChannels(@NonNull java.util.List<android.telephony.RadioAccessSpecifier>, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Boolean>);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setSystemSelectionChannels(@NonNull java.util.List<android.telephony.RadioAccessSpecifier>);
method @Deprecated public void setVisualVoicemailEnabled(android.telecom.PhoneAccountHandle, boolean);
@@ -11095,6 +11098,11 @@
field public static final int SET_CARRIER_RESTRICTION_ERROR = 2; // 0x2
field public static final int SET_CARRIER_RESTRICTION_NOT_SUPPORTED = 1; // 0x1
field public static final int SET_CARRIER_RESTRICTION_SUCCESS = 0; // 0x0
+ field public static final int SET_SIM_POWER_STATE_ALREADY_IN_STATE = 1; // 0x1
+ field public static final int SET_SIM_POWER_STATE_MODEM_ERROR = 2; // 0x2
+ field public static final int SET_SIM_POWER_STATE_NOT_SUPPORTED = 4; // 0x4
+ field public static final int SET_SIM_POWER_STATE_SIM_ERROR = 3; // 0x3
+ field public static final int SET_SIM_POWER_STATE_SUCCESS = 0; // 0x0
field public static final int SIM_ACTIVATION_STATE_ACTIVATED = 2; // 0x2
field public static final int SIM_ACTIVATION_STATE_ACTIVATING = 1; // 0x1
field public static final int SIM_ACTIVATION_STATE_DEACTIVATED = 3; // 0x3
diff --git a/core/api/test-current.txt b/core/api/test-current.txt
index ffb31c9..1253197 100644
--- a/core/api/test-current.txt
+++ b/core/api/test-current.txt
@@ -216,6 +216,7 @@
field public static final String KEY_FG_SERVICE_STATE_SETTLE_TIME = "fg_service_state_settle_time";
field public static final String KEY_TOP_STATE_SETTLE_TIME = "top_state_settle_time";
field public static final String OPSTR_MANAGE_ONGOING_CALLS = "android:manage_ongoing_calls";
+ field public static final String OPSTR_USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER = "android:use_icc_auth_with_device_identifier";
field public static final int OP_COARSE_LOCATION = 0; // 0x0
field public static final int OP_RECORD_AUDIO = 27; // 0x1b
field public static final int OP_START_FOREGROUND = 76; // 0x4c
diff --git a/core/java/android/animation/OWNERS b/core/java/android/animation/OWNERS
new file mode 100644
index 0000000..822a35c
--- /dev/null
+++ b/core/java/android/animation/OWNERS
@@ -0,0 +1,6 @@
+# Bug component: 47085
+
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/app/AppOpsManager.java b/core/java/android/app/AppOpsManager.java
index 4dd6a7e..f60f569 100644
--- a/core/java/android/app/AppOpsManager.java
+++ b/core/java/android/app/AppOpsManager.java
@@ -1166,8 +1166,12 @@
public static final int OP_MANAGE_CREDENTIALS = AppProtoEnums.APP_OP_MANAGE_CREDENTIALS;
/** @hide */
+ public static final int OP_USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER =
+ AppProtoEnums.APP_OP_USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER;
+
+ /** @hide */
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
- public static final int _NUM_OP = 105;
+ public static final int _NUM_OP = 106;
/** Access to coarse location information. */
public static final String OPSTR_COARSE_LOCATION = "android:coarse_location";
@@ -1525,6 +1529,15 @@
*/
public static final String OPSTR_MANAGE_CREDENTIALS = "android:manage_credentials";
+ /**
+ * Allows to read device identifiers and use ICC based authentication like EAP-AKA.
+ *
+ * @hide
+ */
+ @TestApi
+ public static final String OPSTR_USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER =
+ "android:use_icc_auth_with_device_identifier";
+
/** {@link #sAppOpsToNote} not initialized yet for this op */
private static final byte SHOULD_COLLECT_NOTE_OP_NOT_INITIALIZED = 0;
/** Should not collect noting of this app-op in {@link #sAppOpsToNote} */
@@ -1604,6 +1617,7 @@
OP_INTERACT_ACROSS_PROFILES,
OP_LOADER_USAGE_STATS,
OP_MANAGE_ONGOING_CALLS,
+ OP_USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER,
};
/**
@@ -1720,6 +1734,7 @@
OP_RECORD_AUDIO_HOTWORD, // RECORD_AUDIO_HOTWORD
OP_MANAGE_ONGOING_CALLS, // MANAGE_ONGOING_CALLS
OP_MANAGE_CREDENTIALS, // MANAGE_CREDENTIALS
+ OP_USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER, // USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER
};
/**
@@ -1831,6 +1846,7 @@
OPSTR_RECORD_AUDIO_HOTWORD,
OPSTR_MANAGE_ONGOING_CALLS,
OPSTR_MANAGE_CREDENTIALS,
+ OPSTR_USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER,
};
/**
@@ -1943,6 +1959,7 @@
"RECORD_AUDIO_HOTWORD",
"MANAGE_ONGOING_CALLS",
"MANAGE_CREDENTIALS",
+ "USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER",
};
/**
@@ -2056,6 +2073,7 @@
null, // no permission for OP_RECORD_AUDIO_HOTWORD
Manifest.permission.MANAGE_ONGOING_CALLS,
null, // no permission for OP_MANAGE_CREDENTIALS
+ Manifest.permission.USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER,
};
/**
@@ -2169,6 +2187,7 @@
null, // RECORD_AUDIO_HOTWORD
null, // MANAGE_ONGOING_CALLS
null, // MANAGE_CREDENTIALS
+ null, // USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER
};
/**
@@ -2281,6 +2300,7 @@
null, // RECORD_AUDIO_HOTWORD
null, // MANAGE_ONGOING_CALLS
null, // MANAGE_CREDENTIALS
+ null, // USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER
};
/**
@@ -2392,6 +2412,7 @@
AppOpsManager.MODE_ALLOWED, // OP_RECORD_AUDIO_HOTWORD
AppOpsManager.MODE_DEFAULT, // MANAGE_ONGOING_CALLS
AppOpsManager.MODE_DEFAULT, // MANAGE_CREDENTIALS
+ AppOpsManager.MODE_DEFAULT, // USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER
};
/**
@@ -2507,6 +2528,7 @@
false, // RECORD_AUDIO_HOTWORD
true, // MANAGE_ONGOING_CALLS
false, // MANAGE_CREDENTIALS
+ true, // USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER
};
/**
diff --git a/core/java/android/app/OWNERS b/core/java/android/app/OWNERS
new file mode 100644
index 0000000..633d093
--- /dev/null
+++ b/core/java/android/app/OWNERS
@@ -0,0 +1 @@
+per-file *Zygote* = file:/ZYGOTE_OWNERS
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index 4095acc..251252e 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -5758,7 +5758,6 @@
return null;
}
-
/**
* Called by a device or profile owner, or delegated certificate chooser (an app that has been
* delegated the {@link #DELEGATION_CERT_SELECTION} privilege), to grant an application access
@@ -5796,6 +5795,51 @@
/**
* Called by a device or profile owner, or delegated certificate chooser (an app that has been
+ * delegated the {@link #DELEGATION_CERT_SELECTION} privilege), to query which apps have access
+ * to a given KeyChain key.
+ *
+ * Key are granted on a per-UID basis, so if several apps share the same UID, granting access to
+ * one of them automatically grants it to others. This method returns a set of sets of package
+ * names, where each internal set contains all packages sharing the same UID. Grantee packages
+ * that don't share UID with other packages are represented by singleton sets.
+ *
+ * @param alias The alias of the key to grant access to.
+ * @return package names of apps that have access to a given key, grouped by UIDs
+ *
+ * @throws SecurityException if the caller is not a device owner, a profile owner or
+ * delegated certificate chooser.
+ * @throws IllegalArgumentException if {@code alias} doesn't correspond to an existing key.
+ *
+ * @see #grantKeyPairToApp(ComponentName, String, String)
+ */
+ public @NonNull Set<Set<String>> getKeyPairGrants(@NonNull String alias) {
+ throwIfParentInstance("getKeyPairGrants");
+ try {
+ // Set of sets is flattened into a null-separated list.
+ final List<String> flattened =
+ mService.getKeyPairGrants(mContext.getPackageName(), alias);
+ final Set<Set<String>> result = new HashSet<>();
+ Set<String> pkgsForOneUid = new HashSet<>();
+ for (final String pkg : flattened) {
+ if (pkg == null) {
+ result.add(pkgsForOneUid);
+ pkgsForOneUid = new HashSet<>();
+ } else {
+ pkgsForOneUid.add(pkg);
+ }
+ }
+ if (!pkgsForOneUid.isEmpty()) {
+ result.add(pkgsForOneUid);
+ }
+ return result;
+ } catch (RemoteException e) {
+ e.rethrowFromSystemServer();
+ }
+ return null;
+ }
+
+ /**
+ * Called by a device or profile owner, or delegated certificate chooser (an app that has been
* delegated the {@link #DELEGATION_CERT_SELECTION} privilege), to revoke an application's
* grant to a KeyChain key pair.
* Calls by the application to {@link android.security.KeyChain#getPrivateKey}
diff --git a/core/java/android/app/admin/IDevicePolicyManager.aidl b/core/java/android/app/admin/IDevicePolicyManager.aidl
index e21fee2..bcc90f7 100644
--- a/core/java/android/app/admin/IDevicePolicyManager.aidl
+++ b/core/java/android/app/admin/IDevicePolicyManager.aidl
@@ -471,6 +471,7 @@
boolean startViewCalendarEventInManagedProfile(String packageName, long eventId, long start, long end, boolean allDay, int flags);
boolean setKeyGrantForApp(in ComponentName admin, String callerPackage, String alias, String packageName, boolean hasGrant);
+ List<String> getKeyPairGrants(in String callerPackage, in String alias);
void setUserControlDisabledPackages(in ComponentName admin, in List<String> packages);
diff --git a/core/java/android/app/admin/OWNERS b/core/java/android/app/admin/OWNERS
new file mode 100644
index 0000000..64a1d27
--- /dev/null
+++ b/core/java/android/app/admin/OWNERS
@@ -0,0 +1,4 @@
+# Bug component: 142675
+
[email protected]
[email protected]
diff --git a/core/java/android/app/assist/OWNERS b/core/java/android/app/assist/OWNERS
new file mode 100644
index 0000000..46b5ea0
--- /dev/null
+++ b/core/java/android/app/assist/OWNERS
@@ -0,0 +1,7 @@
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/app/contentsuggestions/OWNERS b/core/java/android/app/contentsuggestions/OWNERS
new file mode 100644
index 0000000..482abb2
--- /dev/null
+++ b/core/java/android/app/contentsuggestions/OWNERS
@@ -0,0 +1,9 @@
+# Bug component: 643919
+
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/app/prediction/OWNERS b/core/java/android/app/prediction/OWNERS
new file mode 100644
index 0000000..fe012da
--- /dev/null
+++ b/core/java/android/app/prediction/OWNERS
@@ -0,0 +1,2 @@
[email protected]
[email protected]
diff --git a/core/java/android/app/role/OWNERS b/core/java/android/app/role/OWNERS
index b94d988..b8076366 100644
--- a/core/java/android/app/role/OWNERS
+++ b/core/java/android/app/role/OWNERS
@@ -1,6 +1,4 @@
[email protected]
[email protected]
+# Bug component: 137825
+
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/app/servertransaction/OWNERS b/core/java/android/app/servertransaction/OWNERS
new file mode 100644
index 0000000..aa6248e
--- /dev/null
+++ b/core/java/android/app/servertransaction/OWNERS
@@ -0,0 +1,3 @@
+# Bug component: 316125
+
+include /services/core/java/com/android/server/wm/OWNERS
diff --git a/core/java/android/app/slice/OWNERS b/core/java/android/app/slice/OWNERS
new file mode 100644
index 0000000..b0a44fb
--- /dev/null
+++ b/core/java/android/app/slice/OWNERS
@@ -0,0 +1,6 @@
+# Bug component: 342804
+
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/app/timedetector/OWNERS b/core/java/android/app/timedetector/OWNERS
new file mode 100644
index 0000000..8c11324
--- /dev/null
+++ b/core/java/android/app/timedetector/OWNERS
@@ -0,0 +1,4 @@
+# Bug component: 847766
+
[email protected]
[email protected]
diff --git a/core/java/android/app/timezone/OWNERS b/core/java/android/app/timezone/OWNERS
new file mode 100644
index 0000000..8c11324
--- /dev/null
+++ b/core/java/android/app/timezone/OWNERS
@@ -0,0 +1,4 @@
+# Bug component: 847766
+
[email protected]
[email protected]
diff --git a/core/java/android/app/usage/OWNERS b/core/java/android/app/usage/OWNERS
new file mode 100644
index 0000000..a33d0ad
--- /dev/null
+++ b/core/java/android/app/usage/OWNERS
@@ -0,0 +1,5 @@
+# Bug component: 532296
+
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/attention/OWNERS b/core/java/android/attention/OWNERS
new file mode 100644
index 0000000..dd579b6
--- /dev/null
+++ b/core/java/android/attention/OWNERS
@@ -0,0 +1 @@
[email protected]
diff --git a/core/java/android/bluetooth/OWNERS b/core/java/android/bluetooth/OWNERS
new file mode 100644
index 0000000..3523ee0
--- /dev/null
+++ b/core/java/android/bluetooth/OWNERS
@@ -0,0 +1,4 @@
+# Bug component: 27441
+
[email protected]
[email protected]
diff --git a/core/java/android/bluetooth/le/OWNERS b/core/java/android/bluetooth/le/OWNERS
new file mode 100644
index 0000000..3523ee0
--- /dev/null
+++ b/core/java/android/bluetooth/le/OWNERS
@@ -0,0 +1,4 @@
+# Bug component: 27441
+
[email protected]
[email protected]
diff --git a/core/java/android/content/om/OWNERS b/core/java/android/content/om/OWNERS
new file mode 100644
index 0000000..91a0abf
--- /dev/null
+++ b/core/java/android/content/om/OWNERS
@@ -0,0 +1,6 @@
+# Bug component: 568631
+
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/content/pm/OWNERS b/core/java/android/content/pm/OWNERS
index a16bb4f..3a590da 100644
--- a/core/java/android/content/pm/OWNERS
+++ b/core/java/android/content/pm/OWNERS
@@ -1 +1,7 @@
+# Bug component: 36137
+
[email protected]
[email protected]
[email protected]
+
per-file PackageParser.java = [email protected]
diff --git a/core/java/android/content/pm/dex/OWNERS b/core/java/android/content/pm/dex/OWNERS
new file mode 100644
index 0000000..267e5d58
--- /dev/null
+++ b/core/java/android/content/pm/dex/OWNERS
@@ -0,0 +1,7 @@
+# Bug component: 86431
+
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/content/pm/permission/OWNERS b/core/java/android/content/pm/permission/OWNERS
new file mode 100644
index 0000000..cde7b2a
--- /dev/null
+++ b/core/java/android/content/pm/permission/OWNERS
@@ -0,0 +1,11 @@
+# Bug component: 137825
+
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/content/pm/split/OWNERS b/core/java/android/content/pm/split/OWNERS
new file mode 100644
index 0000000..3d126d2
--- /dev/null
+++ b/core/java/android/content/pm/split/OWNERS
@@ -0,0 +1,5 @@
+# Bug component: 36137
+
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/content/res/OWNERS b/core/java/android/content/res/OWNERS
new file mode 100644
index 0000000..bc2355c
--- /dev/null
+++ b/core/java/android/content/res/OWNERS
@@ -0,0 +1,6 @@
+# Bug component: 568761
+
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/content/rollback/OWNERS b/core/java/android/content/rollback/OWNERS
new file mode 100644
index 0000000..3093fd6
--- /dev/null
+++ b/core/java/android/content/rollback/OWNERS
@@ -0,0 +1,5 @@
+# Bug component: 557916
+
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/database/OWNERS b/core/java/android/database/OWNERS
index 7e19942..1734cfc 100644
--- a/core/java/android/database/OWNERS
+++ b/core/java/android/database/OWNERS
@@ -1,3 +1,3 @@
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/gesture/OWNERS b/core/java/android/gesture/OWNERS
new file mode 100644
index 0000000..b3b8775
--- /dev/null
+++ b/core/java/android/gesture/OWNERS
@@ -0,0 +1,8 @@
+# Bug component: 25700
+
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/hardware/biometrics/OWNERS b/core/java/android/hardware/biometrics/OWNERS
new file mode 100644
index 0000000..33527f8
--- /dev/null
+++ b/core/java/android/hardware/biometrics/OWNERS
@@ -0,0 +1,3 @@
+# Bug component: 879035
+
[email protected]
diff --git a/core/java/android/hardware/display/OWNERS b/core/java/android/hardware/display/OWNERS
index 9ca3910..5bcd9bb8 100644
--- a/core/java/android/hardware/display/OWNERS
+++ b/core/java/android/hardware/display/OWNERS
@@ -1,2 +1,6 @@
+# Bug component: 345010
+
+include /services/core/java/com/android/server/display/OWNERS
+
[email protected]
[email protected]
diff --git a/core/java/android/hardware/face/OWNERS b/core/java/android/hardware/face/OWNERS
new file mode 100644
index 0000000..33527f8
--- /dev/null
+++ b/core/java/android/hardware/face/OWNERS
@@ -0,0 +1,3 @@
+# Bug component: 879035
+
[email protected]
diff --git a/core/java/android/hardware/fingerprint/OWNERS b/core/java/android/hardware/fingerprint/OWNERS
new file mode 100644
index 0000000..dcead40
--- /dev/null
+++ b/core/java/android/hardware/fingerprint/OWNERS
@@ -0,0 +1,3 @@
+# Bug component: 114777
+
[email protected]
diff --git a/core/java/android/hardware/hdmi/OWNERS b/core/java/android/hardware/hdmi/OWNERS
new file mode 100644
index 0000000..16c15e3
--- /dev/null
+++ b/core/java/android/hardware/hdmi/OWNERS
@@ -0,0 +1,6 @@
+# Bug component: 826094
+
+include /services/core/java/com/android/server/display/OWNERS
+
[email protected]
[email protected]
diff --git a/core/java/android/hardware/input/IInputManager.aidl b/core/java/android/hardware/input/IInputManager.aidl
index dc6f579..57c0398 100644
--- a/core/java/android/hardware/input/IInputManager.aidl
+++ b/core/java/android/hardware/input/IInputManager.aidl
@@ -22,6 +22,7 @@
import android.hardware.input.IInputDevicesChangedListener;
import android.hardware.input.ITabletModeChangedListener;
import android.hardware.input.TouchCalibration;
+import android.os.CombinedVibrationEffect;
import android.os.IBinder;
import android.os.VibrationEffect;
import android.view.InputDevice;
@@ -85,7 +86,10 @@
// Input device vibrator control.
void vibrate(int deviceId, in VibrationEffect effect, IBinder token);
+ void vibrateCombined(int deviceId, in CombinedVibrationEffect effect, IBinder token);
void cancelVibrate(int deviceId, IBinder token);
+ int[] getVibratorIds(int deviceId);
+ boolean isVibrating(int deviceId);
void setPointerIconType(int typeId);
void setCustomPointerIcon(in PointerIcon icon);
diff --git a/core/java/android/hardware/input/InputDeviceVibrator.java b/core/java/android/hardware/input/InputDeviceVibrator.java
new file mode 100644
index 0000000..c60d6ce
--- /dev/null
+++ b/core/java/android/hardware/input/InputDeviceVibrator.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2020 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.hardware.input;
+
+import android.annotation.CallbackExecutor;
+import android.annotation.NonNull;
+import android.os.Binder;
+import android.os.VibrationAttributes;
+import android.os.VibrationEffect;
+import android.os.Vibrator;
+
+import java.util.concurrent.Executor;
+
+/**
+ * Vibrator implementation that communicates with the input device vibrators.
+ */
+final class InputDeviceVibrator extends Vibrator {
+ // mDeviceId represents InputDevice ID the vibrator belongs to
+ private final int mDeviceId;
+ private final int mVibratorId;
+ private final Binder mToken;
+ private final InputManager mInputManager;
+
+ InputDeviceVibrator(InputManager inputManager, int deviceId, int vibratorId) {
+ mInputManager = inputManager;
+ mDeviceId = deviceId;
+ mVibratorId = vibratorId;
+ mToken = new Binder();
+ }
+
+ @Override
+ public boolean hasVibrator() {
+ return true;
+ }
+
+ @Override
+ public boolean isVibrating() {
+ return mInputManager.isVibrating(mDeviceId);
+ }
+
+ /* TODO: b/161634264 Support Vibrator listener API in input devices */
+ @Override
+ public void addVibratorStateListener(@NonNull OnVibratorStateChangedListener listener) {
+ throw new UnsupportedOperationException(
+ "addVibratorStateListener not supported in InputDeviceVibrator");
+ }
+
+ @Override
+ public void addVibratorStateListener(
+ @NonNull @CallbackExecutor Executor executor,
+ @NonNull OnVibratorStateChangedListener listener) {
+ throw new UnsupportedOperationException(
+ "addVibratorStateListener not supported in InputDeviceVibrator");
+ }
+
+ @Override
+ public void removeVibratorStateListener(@NonNull OnVibratorStateChangedListener listener) {
+ throw new UnsupportedOperationException(
+ "removeVibratorStateListener not supported in InputDeviceVibrator");
+ }
+
+ @Override
+ public boolean hasAmplitudeControl() {
+ return true;
+ }
+
+ /**
+ * @hide
+ */
+ @Override
+ public void vibrate(int uid, String opPkg, @NonNull VibrationEffect effect,
+ String reason, @NonNull VibrationAttributes attributes) {
+ mInputManager.vibrate(mDeviceId, effect, mToken);
+ }
+
+ @Override
+ public void cancel() {
+ mInputManager.cancelVibrate(mDeviceId, mToken);
+ }
+}
diff --git a/core/java/android/hardware/input/InputDeviceVibratorManager.java b/core/java/android/hardware/input/InputDeviceVibratorManager.java
new file mode 100644
index 0000000..a381b02
--- /dev/null
+++ b/core/java/android/hardware/input/InputDeviceVibratorManager.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2020 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.hardware.input;
+
+import android.os.Binder;
+import android.os.CombinedVibrationEffect;
+import android.os.NullVibrator;
+import android.os.Vibrator;
+import android.os.VibratorManager;
+import android.util.SparseArray;
+import android.view.InputDevice;
+
+import com.android.internal.annotations.GuardedBy;
+
+/**
+ * Vibrator manager implementation that communicates with the input device vibrators.
+ *
+ * @hide
+ */
+public class InputDeviceVibratorManager extends VibratorManager
+ implements InputManager.InputDeviceListener {
+ private static final String TAG = "InputDeviceVibratorManager";
+ private static final boolean DEBUG = false;
+
+ private final Binder mToken;
+ private final InputManager mInputManager;
+
+ // The input device Id.
+ private final int mDeviceId;
+ // Vibrator map from Vibrator Id to Vibrator
+ @GuardedBy("mVibrators")
+ private final SparseArray<Vibrator> mVibrators = new SparseArray<>();
+
+ public InputDeviceVibratorManager(InputManager inputManager, int deviceId) {
+ mInputManager = inputManager;
+ mDeviceId = deviceId;
+ mToken = new Binder();
+
+ initializeVibrators();
+ }
+
+ private void initializeVibrators() {
+ synchronized (mVibrators) {
+ mVibrators.clear();
+ InputDevice inputDevice = InputDevice.getDevice(mDeviceId);
+ final int[] vibratorIds =
+ mInputManager.getVibratorIds(mDeviceId);
+ for (int i = 0; i < vibratorIds.length; i++) {
+ mVibrators.put(vibratorIds[i],
+ new InputDeviceVibrator(mInputManager, mDeviceId, vibratorIds[i]));
+ }
+ }
+ }
+
+ @Override
+ public void onInputDeviceAdded(int deviceId) {
+ }
+
+ @Override
+ public void onInputDeviceRemoved(int deviceId) {
+ synchronized (mVibrators) {
+ if (deviceId == mDeviceId) {
+ mVibrators.clear();
+ }
+ }
+ }
+
+ @Override
+ public void onInputDeviceChanged(int deviceId) {
+ if (deviceId == mDeviceId) {
+ initializeVibrators();
+ }
+ }
+
+ @Override
+ public int[] getVibratorIds() {
+ synchronized (mVibrators) {
+ int[] vibratorIds = new int[mVibrators.size()];
+ for (int idx = 0; idx < mVibrators.size(); idx++) {
+ vibratorIds[idx++] = mVibrators.keyAt(idx);
+ }
+ return vibratorIds;
+ }
+ }
+
+ @Override
+ public Vibrator getVibrator(int vibratorId) {
+ synchronized (mVibrators) {
+ if (mVibrators.contains(vibratorId)) {
+ return mVibrators.get(vibratorId);
+ }
+ }
+ return NullVibrator.getInstance();
+ }
+
+ @Override
+ public Vibrator getDefaultVibrator() {
+ // Returns vibrator ID 0
+ synchronized (mVibrators) {
+ if (mVibrators.size() > 0) {
+ return mVibrators.valueAt(0);
+ }
+ }
+ return NullVibrator.getInstance();
+ }
+
+ @Override
+ public void vibrate(CombinedVibrationEffect effect) {
+ mInputManager.vibrate(mDeviceId, effect, mToken);
+ }
+}
diff --git a/core/java/android/hardware/input/InputManager.java b/core/java/android/hardware/input/InputManager.java
index 81ea2f5..f1d60f6 100644
--- a/core/java/android/hardware/input/InputManager.java
+++ b/core/java/android/hardware/input/InputManager.java
@@ -17,7 +17,6 @@
package android.hardware.input;
import android.Manifest;
-import android.annotation.CallbackExecutor;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -29,9 +28,9 @@
import android.compat.annotation.ChangeId;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
-import android.os.Binder;
import android.os.BlockUntrustedTouchesMode;
import android.os.Build;
+import android.os.CombinedVibrationEffect;
import android.os.Handler;
import android.os.IBinder;
import android.os.InputEventInjectionSync;
@@ -41,9 +40,9 @@
import android.os.ServiceManager;
import android.os.ServiceManager.ServiceNotFoundException;
import android.os.SystemClock;
-import android.os.VibrationAttributes;
import android.os.VibrationEffect;
import android.os.Vibrator;
+import android.os.VibratorManager;
import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
import android.util.Log;
@@ -64,7 +63,6 @@
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.List;
-import java.util.concurrent.Executor;
/**
* Provides information about input devices and available key layouts.
@@ -1287,8 +1285,75 @@
* @return The vibrator, never null.
* @hide
*/
- public Vibrator getInputDeviceVibrator(int deviceId) {
- return new InputDeviceVibrator(deviceId);
+ public Vibrator getInputDeviceVibrator(int deviceId, int vibratorId) {
+ return new InputDeviceVibrator(this, deviceId, vibratorId);
+ }
+
+ /**
+ * Gets a vibrator manager service associated with an input device, always create a new
+ * instance.
+ * @return The vibrator manager, never null.
+ * @hide
+ */
+ @NonNull
+ public VibratorManager getInputDeviceVibratorManager(int deviceId) {
+ return new InputDeviceVibratorManager(InputManager.this, deviceId);
+ }
+
+ /*
+ * Get the list of device vibrators
+ * @return The list of vibrators IDs
+ */
+ int[] getVibratorIds(int deviceId) {
+ try {
+ return mIm.getVibratorIds(deviceId);
+ } catch (RemoteException ex) {
+ throw ex.rethrowFromSystemServer();
+ }
+ }
+
+ /*
+ * Perform vibration effect
+ */
+ void vibrate(int deviceId, VibrationEffect effect, IBinder token) {
+ try {
+ mIm.vibrate(deviceId, effect, token);
+ } catch (RemoteException ex) {
+ throw ex.rethrowFromSystemServer();
+ }
+ }
+
+ /*
+ * Perform combined vibration effect
+ */
+ void vibrate(int deviceId, CombinedVibrationEffect effect, IBinder token) {
+ try {
+ mIm.vibrateCombined(deviceId, effect, token);
+ } catch (RemoteException ex) {
+ throw ex.rethrowFromSystemServer();
+ }
+ }
+
+ /*
+ * Cancel an ongoing vibration
+ */
+ void cancelVibrate(int deviceId, IBinder token) {
+ try {
+ mIm.cancelVibrate(deviceId, token);
+ } catch (RemoteException ex) {
+ throw ex.rethrowFromSystemServer();
+ }
+ }
+
+ /*
+ * Check if input device is vibrating
+ */
+ boolean isVibrating(int deviceId) {
+ try {
+ return mIm.isVibrating(deviceId);
+ } catch (RemoteException ex) {
+ throw ex.rethrowFromSystemServer();
+ }
}
/**
@@ -1401,72 +1466,4 @@
}
}
}
-
- private final class InputDeviceVibrator extends Vibrator {
- private final int mDeviceId;
- private final Binder mToken;
-
- public InputDeviceVibrator(int deviceId) {
- mDeviceId = deviceId;
- mToken = new Binder();
- }
-
- @Override
- public boolean hasVibrator() {
- return true;
- }
-
- @Override
- public boolean isVibrating() {
- throw new UnsupportedOperationException(
- "isVibrating not supported in InputDeviceVibrator");
- }
-
- @Override
- public void addVibratorStateListener(@NonNull OnVibratorStateChangedListener listener) {
- throw new UnsupportedOperationException(
- "addVibratorStateListener not supported in InputDeviceVibrator");
- }
-
- @Override
- public void addVibratorStateListener(
- @NonNull @CallbackExecutor Executor executor,
- @NonNull OnVibratorStateChangedListener listener) {
- throw new UnsupportedOperationException(
- "addVibratorStateListener not supported in InputDeviceVibrator");
- }
-
- @Override
- public void removeVibratorStateListener(@NonNull OnVibratorStateChangedListener listener) {
- throw new UnsupportedOperationException(
- "removeVibratorStateListener not supported in InputDeviceVibrator");
- }
-
- @Override
- public boolean hasAmplitudeControl() {
- return true;
- }
-
- /**
- * @hide
- */
- @Override
- public void vibrate(int uid, String opPkg, @NonNull VibrationEffect effect,
- String reason, @NonNull VibrationAttributes attributes) {
- try {
- mIm.vibrate(mDeviceId, effect, mToken);
- } catch (RemoteException ex) {
- throw ex.rethrowFromSystemServer();
- }
- }
-
- @Override
- public void cancel() {
- try {
- mIm.cancelVibrate(mDeviceId, mToken);
- } catch (RemoteException ex) {
- throw ex.rethrowFromSystemServer();
- }
- }
- }
}
diff --git a/core/java/android/hardware/input/OWNERS b/core/java/android/hardware/input/OWNERS
index 0313a40..25e02e1 100644
--- a/core/java/android/hardware/input/OWNERS
+++ b/core/java/android/hardware/input/OWNERS
@@ -1,2 +1,6 @@
+# Bug component: 136048
+
+include /services/core/java/com/android/server/input/OWNERS
+
[email protected]
[email protected]
diff --git a/core/java/android/hardware/iris/OWNERS b/core/java/android/hardware/iris/OWNERS
new file mode 100644
index 0000000..33527f8
--- /dev/null
+++ b/core/java/android/hardware/iris/OWNERS
@@ -0,0 +1,3 @@
+# Bug component: 879035
+
[email protected]
diff --git a/core/java/android/hardware/lights/OWNERS b/core/java/android/hardware/lights/OWNERS
new file mode 100644
index 0000000..cb46a80
--- /dev/null
+++ b/core/java/android/hardware/lights/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/lights/OWNERS
diff --git a/core/java/android/hardware/location/OWNERS b/core/java/android/hardware/location/OWNERS
new file mode 100644
index 0000000..383321b
--- /dev/null
+++ b/core/java/android/hardware/location/OWNERS
@@ -0,0 +1,6 @@
+# Bug component: 880425
+
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/hardware/soundtrigger/OWNERS b/core/java/android/hardware/soundtrigger/OWNERS
new file mode 100644
index 0000000..816bc6b
--- /dev/null
+++ b/core/java/android/hardware/soundtrigger/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/media/soundtrigger/OWNERS
diff --git a/core/java/android/hardware/usb/OWNERS b/core/java/android/hardware/usb/OWNERS
index 8ee72b5..8f2b39d 100644
--- a/core/java/android/hardware/usb/OWNERS
+++ b/core/java/android/hardware/usb/OWNERS
@@ -1,6 +1,4 @@
[email protected]
[email protected]
+# Bug component: 175220
+
[email protected]
[email protected]
[email protected]
[email protected]
\ No newline at end of file
[email protected]
diff --git a/core/java/android/inputmethodservice/OWNERS b/core/java/android/inputmethodservice/OWNERS
index 4447197..e6a04da 100644
--- a/core/java/android/inputmethodservice/OWNERS
+++ b/core/java/android/inputmethodservice/OWNERS
@@ -1,3 +1,4 @@
+# Bug component: 34867
set noparent
-include ../../../../services/core/java/com/android/server/inputmethod/OWNERS
+include /services/core/java/com/android/server/inputmethod/OWNERS
diff --git a/core/java/android/metrics/OWNERS b/core/java/android/metrics/OWNERS
new file mode 100644
index 0000000..ba867e0
--- /dev/null
+++ b/core/java/android/metrics/OWNERS
@@ -0,0 +1,4 @@
+# Bug component: 26805
+
[email protected]
[email protected]
diff --git a/core/java/android/net/NetworkUtils.java b/core/java/android/net/NetworkUtils.java
index a0faafa..d84ee2a 100644
--- a/core/java/android/net/NetworkUtils.java
+++ b/core/java/android/net/NetworkUtils.java
@@ -35,7 +35,6 @@
import java.net.InetAddress;
import java.net.SocketException;
import java.net.UnknownHostException;
-import java.util.Collection;
import java.util.Locale;
import java.util.TreeSet;
@@ -342,20 +341,6 @@
}
/**
- * Create a string array of host addresses from a collection of InetAddresses
- * @param addrs a Collection of InetAddresses
- * @return an array of Strings containing their host addresses
- */
- public static String[] makeStrings(Collection<InetAddress> addrs) {
- String[] result = new String[addrs.size()];
- int i = 0;
- for (InetAddress addr : addrs) {
- result[i++] = addr.getHostAddress();
- }
- return result;
- }
-
- /**
* Trim leading zeros from IPv4 address strings
* Our base libraries will interpret that as octel..
* Must leave non v4 addresses and host names alone.
diff --git a/core/java/android/net/OWNERS b/core/java/android/net/OWNERS
index 5e2a718..2f8f685 100644
--- a/core/java/android/net/OWNERS
+++ b/core/java/android/net/OWNERS
@@ -2,7 +2,7 @@
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/net/Proxy.java b/core/java/android/net/Proxy.java
index f1d9669..20ccc07 100644
--- a/core/java/android/net/Proxy.java
+++ b/core/java/android/net/Proxy.java
@@ -205,7 +205,7 @@
if (host.equalsIgnoreCase("localhost")) {
return true;
}
- if (NetworkUtils.numericToInetAddress(host).isLoopbackAddress()) {
+ if (InetAddresses.parseNumericAddress(host).isLoopbackAddress()) {
return true;
}
}
diff --git a/core/java/android/nfc/OWNERS b/core/java/android/nfc/OWNERS
new file mode 100644
index 0000000..6aaf039
--- /dev/null
+++ b/core/java/android/nfc/OWNERS
@@ -0,0 +1,4 @@
+# Bug component: 48448
+
[email protected]
[email protected]
diff --git a/core/java/android/nfc/cardemulation/OWNERS b/core/java/android/nfc/cardemulation/OWNERS
new file mode 100644
index 0000000..6aaf039
--- /dev/null
+++ b/core/java/android/nfc/cardemulation/OWNERS
@@ -0,0 +1,4 @@
+# Bug component: 48448
+
[email protected]
[email protected]
diff --git a/core/java/android/nfc/dta/OWNERS b/core/java/android/nfc/dta/OWNERS
new file mode 100644
index 0000000..6aaf039
--- /dev/null
+++ b/core/java/android/nfc/dta/OWNERS
@@ -0,0 +1,4 @@
+# Bug component: 48448
+
[email protected]
[email protected]
diff --git a/core/java/android/nfc/tech/OWNERS b/core/java/android/nfc/tech/OWNERS
new file mode 100644
index 0000000..6aaf039
--- /dev/null
+++ b/core/java/android/nfc/tech/OWNERS
@@ -0,0 +1,4 @@
+# Bug component: 48448
+
[email protected]
[email protected]
diff --git a/core/java/android/os/CombinedVibrationEffect.java b/core/java/android/os/CombinedVibrationEffect.java
index c9ebc1b..7ec7fff 100644
--- a/core/java/android/os/CombinedVibrationEffect.java
+++ b/core/java/android/os/CombinedVibrationEffect.java
@@ -30,8 +30,6 @@
* Vibrator Vibrators}.
*
* These effects may be any number of things, from single shot vibrations to complex waveforms.
- *
- * @hide
* @see VibrationEffect
*/
@SuppressWarnings({"ParcelNotFinal", "ParcelCreator"}) // Parcel only extended here.
@@ -94,7 +92,6 @@
/**
* A combination of haptic effects that should be played in multiple vibrators in sync.
*
- * @hide
* @see CombinedVibrationEffect#startSynced()
*/
public static final class SyncedCombination {
@@ -144,7 +141,6 @@
/**
* A combination of haptic effects that should be played in multiple vibrators in sequence.
*
- * @hide
* @see CombinedVibrationEffect#startSequential()
*/
public static final class SequentialCombination {
diff --git a/core/java/android/os/OWNERS b/core/java/android/os/OWNERS
index 91eb2a5..d392d71 100644
--- a/core/java/android/os/OWNERS
+++ b/core/java/android/os/OWNERS
@@ -16,7 +16,7 @@
per-file PowerManager.java = [email protected], [email protected]
per-file PowerManagerInternal.java = [email protected], [email protected]
-# Zygote
-per-file ZygoteProcess.java = [email protected], [email protected], [email protected], [email protected], [email protected]
per-file GraphicsEnvironment.java = [email protected], [email protected], [email protected], [email protected], [email protected]
+
+per-file *Zygote* = file:/ZYGOTE_OWNERS
diff --git a/core/java/android/os/VibratorManager.java b/core/java/android/os/VibratorManager.java
new file mode 100644
index 0000000..1d5a587
--- /dev/null
+++ b/core/java/android/os/VibratorManager.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2020 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.os;
+
+import android.annotation.NonNull;
+
+/**
+ * VibratorManager provides access to multiple vibrators, as well as the ability to run them in
+ * a synchronized fashion.
+ */
+public abstract class VibratorManager {
+ /** @hide */
+ protected static final String TAG = "VibratorManager";
+
+ /**
+ * {@hide}
+ */
+ public VibratorManager() {
+ }
+
+ /**
+ * This method lists all available actuator ids, returning a possible empty list.
+ * If the device has only a single actuator, this should return a single entry with a
+ * default id.
+ */
+ @NonNull
+ public abstract int[] getVibratorIds();
+
+ /**
+ * Returns a Vibrator service for given id.
+ * This allows users to perform a vibration effect on a single actuator.
+ */
+ @NonNull
+ public abstract Vibrator getVibrator(int vibratorId);
+
+ /**
+ * Returns the system default Vibrator service.
+ */
+ @NonNull
+ public abstract Vibrator getDefaultVibrator();
+
+ /**
+ * Vibrates all actuators by passing each VibrationEffect within CombinedVibrationEffect
+ * to the respective actuator, in sync.
+ */
+ public abstract void vibrate(@NonNull CombinedVibrationEffect effect);
+}
diff --git a/core/java/android/os/connectivity/OWNERS b/core/java/android/os/connectivity/OWNERS
new file mode 100644
index 0000000..a0f0238
--- /dev/null
+++ b/core/java/android/os/connectivity/OWNERS
@@ -0,0 +1 @@
[email protected]
diff --git a/core/java/android/os/health/OWNERS b/core/java/android/os/health/OWNERS
new file mode 100644
index 0000000..6045344
--- /dev/null
+++ b/core/java/android/os/health/OWNERS
@@ -0,0 +1,4 @@
+# Bug component: 26805
+
[email protected]
[email protected]
diff --git a/core/java/android/os/image/OWNERS b/core/java/android/os/image/OWNERS
new file mode 100644
index 0000000..389b55b
--- /dev/null
+++ b/core/java/android/os/image/OWNERS
@@ -0,0 +1 @@
[email protected]
diff --git a/core/java/android/os/storage/OWNERS b/core/java/android/os/storage/OWNERS
new file mode 100644
index 0000000..8af7de5
--- /dev/null
+++ b/core/java/android/os/storage/OWNERS
@@ -0,0 +1,7 @@
+# Bug component: 95221
+
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/permission/OWNERS b/core/java/android/permission/OWNERS
new file mode 100644
index 0000000..d09f351
--- /dev/null
+++ b/core/java/android/permission/OWNERS
@@ -0,0 +1,8 @@
+# Bug component: 137825
+
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/permissionpresenterservice/OWNERS b/core/java/android/permissionpresenterservice/OWNERS
new file mode 100644
index 0000000..d09f351
--- /dev/null
+++ b/core/java/android/permissionpresenterservice/OWNERS
@@ -0,0 +1,8 @@
+# Bug component: 137825
+
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/print/OWNERS b/core/java/android/print/OWNERS
new file mode 100644
index 0000000..72f0983
--- /dev/null
+++ b/core/java/android/print/OWNERS
@@ -0,0 +1,5 @@
+# Bug component: 47273
+
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/print/pdf/OWNERS b/core/java/android/print/pdf/OWNERS
new file mode 100644
index 0000000..72f0983
--- /dev/null
+++ b/core/java/android/print/pdf/OWNERS
@@ -0,0 +1,5 @@
+# Bug component: 47273
+
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/printservice/OWNERS b/core/java/android/printservice/OWNERS
new file mode 100644
index 0000000..72f0983
--- /dev/null
+++ b/core/java/android/printservice/OWNERS
@@ -0,0 +1,5 @@
+# Bug component: 47273
+
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/printservice/recommendation/OWNERS b/core/java/android/printservice/recommendation/OWNERS
new file mode 100644
index 0000000..72f0983
--- /dev/null
+++ b/core/java/android/printservice/recommendation/OWNERS
@@ -0,0 +1,5 @@
+# Bug component: 47273
+
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/provider/OWNERS b/core/java/android/provider/OWNERS
index 97e0156..792ff20 100644
--- a/core/java/android/provider/OWNERS
+++ b/core/java/android/provider/OWNERS
@@ -2,4 +2,8 @@
per-file DeviceConfig.java = [email protected]
per-file DeviceConfig.java = [email protected]
-
+per-file CallLog.java = file:/telephony/OWNERS
+per-file DocumentsContract.java = file:/core/java/android/os/storage/OWNERS
+per-file DocumentsProvider.java = file:/core/java/android/os/storage/OWNERS
+per-file MediaStore.java = file:/core/java/android/os/storage/OWNERS
+per-file Telephony.java = file:/telephony/OWNERS
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 12791bc..fb0aea0 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -14484,10 +14484,11 @@
public static final String SHOW_PEOPLE_SPACE = "show_people_space";
/**
- * Which types of conversations to show in People Space.
+ * Which types of conversation(s) to show in People Space.
* Values are:
- * 0: All conversations (default)
+ * 0: Single user-selected conversation (default)
* 1: Priority conversations only
+ * 2: All conversations
* @hide
*/
public static final String PEOPLE_SPACE_CONVERSATION_TYPE =
diff --git a/core/java/android/se/OWNERS b/core/java/android/se/OWNERS
new file mode 100644
index 0000000..f1539dc
--- /dev/null
+++ b/core/java/android/se/OWNERS
@@ -0,0 +1,4 @@
+# Bug component: 456592
+
[email protected]
[email protected]
diff --git a/core/java/android/se/omapi/OWNERS b/core/java/android/se/omapi/OWNERS
new file mode 100644
index 0000000..f1539dc
--- /dev/null
+++ b/core/java/android/se/omapi/OWNERS
@@ -0,0 +1,4 @@
+# Bug component: 456592
+
[email protected]
[email protected]
diff --git a/core/java/android/security/OWNERS b/core/java/android/security/OWNERS
index 7120376..3f8d75e 100644
--- a/core/java/android/security/OWNERS
+++ b/core/java/android/security/OWNERS
@@ -1,3 +1,8 @@
+# Bug component: 36824
+
[email protected]
[email protected]
+
per-file NetworkSecurityPolicy.java = [email protected]
per-file NetworkSecurityPolicy.java = [email protected]
per-file FrameworkNetworkSecurityPolicy.java = [email protected]
diff --git a/core/java/android/security/keymaster/OWNERS b/core/java/android/security/keymaster/OWNERS
new file mode 100644
index 0000000..65129a4
--- /dev/null
+++ b/core/java/android/security/keymaster/OWNERS
@@ -0,0 +1,5 @@
+# Bug component: 189335
+
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/security/keystore/OWNERS b/core/java/android/security/keystore/OWNERS
index bb487fb..65129a4 100644
--- a/core/java/android/security/keystore/OWNERS
+++ b/core/java/android/security/keystore/OWNERS
@@ -1,4 +1,5 @@
[email protected]
[email protected]
[email protected]
[email protected]
+# Bug component: 189335
+
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/security/keystore/recovery/OWNERS b/core/java/android/security/keystore/recovery/OWNERS
new file mode 100644
index 0000000..65129a4
--- /dev/null
+++ b/core/java/android/security/keystore/recovery/OWNERS
@@ -0,0 +1,5 @@
+# Bug component: 189335
+
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/security/net/OWNERS b/core/java/android/security/net/OWNERS
new file mode 100644
index 0000000..d828164
--- /dev/null
+++ b/core/java/android/security/net/OWNERS
@@ -0,0 +1,4 @@
+# Bug component: 36824
+
[email protected]
[email protected]
diff --git a/core/java/android/security/net/config/OWNERS b/core/java/android/security/net/config/OWNERS
index 5350373..85ce3c6 100644
--- a/core/java/android/security/net/config/OWNERS
+++ b/core/java/android/security/net/config/OWNERS
@@ -1,3 +1,5 @@
+# Bug component: 36824
set noparent
+
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/service/appprediction/OWNERS b/core/java/android/service/appprediction/OWNERS
new file mode 100644
index 0000000..fe012da
--- /dev/null
+++ b/core/java/android/service/appprediction/OWNERS
@@ -0,0 +1,2 @@
[email protected]
[email protected]
diff --git a/core/java/android/service/attention/OWNERS b/core/java/android/service/attention/OWNERS
new file mode 100644
index 0000000..dd579b6
--- /dev/null
+++ b/core/java/android/service/attention/OWNERS
@@ -0,0 +1 @@
[email protected]
diff --git a/core/java/android/service/autofill/OWNERS b/core/java/android/service/autofill/OWNERS
new file mode 100644
index 0000000..a088632
--- /dev/null
+++ b/core/java/android/service/autofill/OWNERS
@@ -0,0 +1,9 @@
+# Bug component: 351486
+
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/service/autofill/augmented/OWNERS b/core/java/android/service/autofill/augmented/OWNERS
new file mode 100644
index 0000000..a088632
--- /dev/null
+++ b/core/java/android/service/autofill/augmented/OWNERS
@@ -0,0 +1,9 @@
+# Bug component: 351486
+
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/service/carrier/OWNERS b/core/java/android/service/carrier/OWNERS
new file mode 100644
index 0000000..d768ef4
--- /dev/null
+++ b/core/java/android/service/carrier/OWNERS
@@ -0,0 +1,5 @@
+# Bug component: 20868
+
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/service/chooser/OWNERS b/core/java/android/service/chooser/OWNERS
new file mode 100644
index 0000000..a5acba5
--- /dev/null
+++ b/core/java/android/service/chooser/OWNERS
@@ -0,0 +1,4 @@
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/service/contentcapture/OWNERS b/core/java/android/service/contentcapture/OWNERS
new file mode 100644
index 0000000..6337327
--- /dev/null
+++ b/core/java/android/service/contentcapture/OWNERS
@@ -0,0 +1,9 @@
+# Bug component: 544200
+
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/service/contentsuggestions/OWNERS b/core/java/android/service/contentsuggestions/OWNERS
new file mode 100644
index 0000000..46b5ea0
--- /dev/null
+++ b/core/java/android/service/contentsuggestions/OWNERS
@@ -0,0 +1,7 @@
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/service/dreams/OWNERS b/core/java/android/service/dreams/OWNERS
index 708ab4c..f831805 100644
--- a/core/java/android/service/dreams/OWNERS
+++ b/core/java/android/service/dreams/OWNERS
@@ -1,4 +1,3 @@
[email protected]
[email protected]
[email protected]
[email protected]
+# Bug component: 78010
+
[email protected]
diff --git a/core/java/android/service/gatekeeper/OWNERS b/core/java/android/service/gatekeeper/OWNERS
new file mode 100644
index 0000000..2ca52cd
--- /dev/null
+++ b/core/java/android/service/gatekeeper/OWNERS
@@ -0,0 +1,3 @@
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/service/media/OWNERS b/core/java/android/service/media/OWNERS
new file mode 100644
index 0000000..916fc36
--- /dev/null
+++ b/core/java/android/service/media/OWNERS
@@ -0,0 +1,8 @@
+# Bug component: 137631
+
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/service/notification/OWNERS b/core/java/android/service/notification/OWNERS
index 2e94be5..debb493 100644
--- a/core/java/android/service/notification/OWNERS
+++ b/core/java/android/service/notification/OWNERS
@@ -1,4 +1,6 @@
+# Bug component: 34005
+
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
\ No newline at end of file
[email protected]
diff --git a/core/java/android/service/quicksettings/OWNERS b/core/java/android/service/quicksettings/OWNERS
new file mode 100644
index 0000000..12eb7c7
--- /dev/null
+++ b/core/java/android/service/quicksettings/OWNERS
@@ -0,0 +1,6 @@
+# Bug component: 78010
+
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/service/resolver/OWNERS b/core/java/android/service/resolver/OWNERS
new file mode 100644
index 0000000..10150c37
--- /dev/null
+++ b/core/java/android/service/resolver/OWNERS
@@ -0,0 +1,6 @@
+# Bug component: 78010
+
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/service/restrictions/OWNERS b/core/java/android/service/restrictions/OWNERS
new file mode 100644
index 0000000..eaba2e9
--- /dev/null
+++ b/core/java/android/service/restrictions/OWNERS
@@ -0,0 +1 @@
[email protected]
diff --git a/core/java/android/service/textclassifier/OWNERS b/core/java/android/service/textclassifier/OWNERS
new file mode 100644
index 0000000..a535f52
--- /dev/null
+++ b/core/java/android/service/textclassifier/OWNERS
@@ -0,0 +1,9 @@
+# Bug component: 709498
+
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/service/textservice/OWNERS b/core/java/android/service/textservice/OWNERS
new file mode 100644
index 0000000..a637754
--- /dev/null
+++ b/core/java/android/service/textservice/OWNERS
@@ -0,0 +1,5 @@
+# Bug component: 34867
+
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/service/trust/OWNERS b/core/java/android/service/trust/OWNERS
new file mode 100644
index 0000000..affe471
--- /dev/null
+++ b/core/java/android/service/trust/OWNERS
@@ -0,0 +1,4 @@
+# Bug component: 36824
+
[email protected]
[email protected]
diff --git a/core/java/android/service/voice/OWNERS b/core/java/android/service/voice/OWNERS
new file mode 100644
index 0000000..46b5ea0
--- /dev/null
+++ b/core/java/android/service/voice/OWNERS
@@ -0,0 +1,7 @@
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/service/wallpaper/OWNERS b/core/java/android/service/wallpaper/OWNERS
new file mode 100644
index 0000000..756eef8
--- /dev/null
+++ b/core/java/android/service/wallpaper/OWNERS
@@ -0,0 +1,5 @@
+# Bug component: 78010
+
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/service/watchdog/OWNERS b/core/java/android/service/watchdog/OWNERS
new file mode 100644
index 0000000..1c045e1
--- /dev/null
+++ b/core/java/android/service/watchdog/OWNERS
@@ -0,0 +1,3 @@
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/timezone/OWNERS b/core/java/android/timezone/OWNERS
new file mode 100644
index 0000000..09447a97
--- /dev/null
+++ b/core/java/android/timezone/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/app/timezone/OWNERS
diff --git a/core/java/android/transition/OWNERS b/core/java/android/transition/OWNERS
new file mode 100644
index 0000000..eb5a581
--- /dev/null
+++ b/core/java/android/transition/OWNERS
@@ -0,0 +1,6 @@
+# Bug component: 25700
+
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/util/proto/OWNERS b/core/java/android/util/proto/OWNERS
new file mode 100644
index 0000000..1eb6abf
--- /dev/null
+++ b/core/java/android/util/proto/OWNERS
@@ -0,0 +1,2 @@
[email protected]
[email protected]
diff --git a/core/java/android/view/IPinnedStackListener.aidl b/core/java/android/view/IPinnedStackListener.aidl
index 84dd8af..29c9c15 100644
--- a/core/java/android/view/IPinnedStackListener.aidl
+++ b/core/java/android/view/IPinnedStackListener.aidl
@@ -58,19 +58,6 @@
void onActivityHidden(in ComponentName componentName);
/**
- * Called when the window manager has detected change on DisplayInfo, or
- * when the listener is first registered to allow the listener to synchronized its state with
- * the controller.
- */
- void onDisplayInfoChanged(in DisplayInfo displayInfo);
-
- /**
- * Called by the window manager at the beginning of a configuration update cascade
- * since the metrics from these resources are used for bounds calculations.
- */
- void onConfigurationChanged();
-
- /**
* Called by the window manager when the aspect ratio is reset.
*/
void onAspectRatioChanged(float aspectRatio);
diff --git a/core/java/android/view/InputDevice.java b/core/java/android/view/InputDevice.java
index 8da833a..df96dc3 100644
--- a/core/java/android/view/InputDevice.java
+++ b/core/java/android/view/InputDevice.java
@@ -17,6 +17,7 @@
package android.view;
import android.annotation.IntDef;
+import android.annotation.NonNull;
import android.annotation.RequiresPermission;
import android.annotation.TestApi;
import android.compat.annotation.UnsupportedAppUsage;
@@ -28,7 +29,9 @@
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Vibrator;
+import android.os.VibratorManager;
+import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
import java.lang.annotation.Retention;
@@ -72,6 +75,9 @@
private Vibrator mVibrator; // guarded by mMotionRanges during initialization
+ @GuardedBy("mMotionRanges")
+ private VibratorManager mVibratorManager;
+
/**
* A mask for input source classes.
*
@@ -415,6 +421,8 @@
private static final int MAX_RANGES = 1000;
+ private static final int VIBRATOR_ID_ALL = -1;
+
public static final @android.annotation.NonNull Parcelable.Creator<InputDevice> CREATOR =
new Parcelable.Creator<InputDevice>() {
public InputDevice createFromParcel(Parcel in) {
@@ -785,7 +793,8 @@
synchronized (mMotionRanges) {
if (mVibrator == null) {
if (mHasVibrator) {
- mVibrator = InputManager.getInstance().getInputDeviceVibrator(mId);
+ mVibrator = InputManager.getInstance().getInputDeviceVibrator(mId,
+ VIBRATOR_ID_ALL);
} else {
mVibrator = NullVibrator.getInstance();
}
@@ -795,6 +804,24 @@
}
/**
+ * Gets the vibrator manager associated with the device.
+ * Even if the device does not have a vibrator manager, the result is never null.
+ * Use {@link VibratorManager#getVibratorIds} to determine whether any vibrator is
+ * present.
+ *
+ * @return The vibrator manager associated with the device, never null.
+ */
+ @NonNull
+ public VibratorManager getVibratorManager() {
+ synchronized (mMotionRanges) {
+ if (mVibratorManager == null) {
+ mVibratorManager = InputManager.getInstance().getInputDeviceVibratorManager(mId);
+ }
+ }
+ return mVibratorManager;
+ }
+
+ /**
* Returns true if input device is enabled.
* @return Whether the input device is enabled.
*/
diff --git a/core/java/android/view/OWNERS b/core/java/android/view/OWNERS
index 7b60f2e..4f82b86 100644
--- a/core/java/android/view/OWNERS
+++ b/core/java/android/view/OWNERS
@@ -1,3 +1,14 @@
+# Bug component: 25700
+
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
+
# Display
per-file Display.java = [email protected], [email protected]
per-file DisplayInfo.java = [email protected], [email protected]
diff --git a/core/java/android/view/accessibility/OWNERS b/core/java/android/view/accessibility/OWNERS
index c6f42f7..93b5a2e 100644
--- a/core/java/android/view/accessibility/OWNERS
+++ b/core/java/android/view/accessibility/OWNERS
@@ -1,4 +1,11 @@
[email protected]
+# Bug component: 44214
+
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/view/animation/OWNERS b/core/java/android/view/animation/OWNERS
new file mode 100644
index 0000000..9b8f4d9
--- /dev/null
+++ b/core/java/android/view/animation/OWNERS
@@ -0,0 +1,6 @@
+# Bug component: 25700
+
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/view/autofill/OWNERS b/core/java/android/view/autofill/OWNERS
new file mode 100644
index 0000000..a088632
--- /dev/null
+++ b/core/java/android/view/autofill/OWNERS
@@ -0,0 +1,9 @@
+# Bug component: 351486
+
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/view/contentcapture/OWNERS b/core/java/android/view/contentcapture/OWNERS
new file mode 100644
index 0000000..6337327
--- /dev/null
+++ b/core/java/android/view/contentcapture/OWNERS
@@ -0,0 +1,9 @@
+# Bug component: 544200
+
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/view/inputmethod/OWNERS b/core/java/android/view/inputmethod/OWNERS
index 244cc30..e6a04da 100644
--- a/core/java/android/view/inputmethod/OWNERS
+++ b/core/java/android/view/inputmethod/OWNERS
@@ -1,3 +1,4 @@
+# Bug component: 34867
set noparent
-include ../../../../../services/core/java/com/android/server/inputmethod/OWNERS
+include /services/core/java/com/android/server/inputmethod/OWNERS
diff --git a/core/java/android/view/inspector/OWNERS b/core/java/android/view/inspector/OWNERS
index c2827cc..705f4b3 100644
--- a/core/java/android/view/inspector/OWNERS
+++ b/core/java/android/view/inspector/OWNERS
@@ -1,3 +1,6 @@
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/view/textclassifier/OWNERS b/core/java/android/view/textclassifier/OWNERS
index be4fbaa..ac80d9f 100644
--- a/core/java/android/view/textclassifier/OWNERS
+++ b/core/java/android/view/textclassifier/OWNERS
@@ -1,14 +1,8 @@
# Bug component: 709498
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
\ No newline at end of file
[email protected]
diff --git a/core/java/android/view/textclassifier/intent/OWNERS b/core/java/android/view/textclassifier/intent/OWNERS
new file mode 100644
index 0000000..ac80d9f
--- /dev/null
+++ b/core/java/android/view/textclassifier/intent/OWNERS
@@ -0,0 +1,8 @@
+# Bug component: 709498
+
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/view/textclassifier/logging/OWNERS b/core/java/android/view/textclassifier/logging/OWNERS
new file mode 100644
index 0000000..ac80d9f
--- /dev/null
+++ b/core/java/android/view/textclassifier/logging/OWNERS
@@ -0,0 +1,8 @@
+# Bug component: 709498
+
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/view/textservice/OWNERS b/core/java/android/view/textservice/OWNERS
new file mode 100644
index 0000000..a637754
--- /dev/null
+++ b/core/java/android/view/textservice/OWNERS
@@ -0,0 +1,5 @@
+# Bug component: 34867
+
[email protected]
[email protected]
[email protected]
diff --git a/core/java/android/widget/OWNERS b/core/java/android/widget/OWNERS
index 5c79d21..fbb975b 100644
--- a/core/java/android/widget/OWNERS
+++ b/core/java/android/widget/OWNERS
@@ -1 +1,9 @@
+# Bug component: 25700
+
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
+
per-file TextView.java, EditText.java, Editor.java = [email protected], [email protected], [email protected]
diff --git a/core/java/android/window/OWNERS b/core/java/android/window/OWNERS
index d10fb31..2c61df9 100644
--- a/core/java/android/window/OWNERS
+++ b/core/java/android/window/OWNERS
@@ -1,3 +1,3 @@
set noparent
-include ../../../../services/core/java/com/android/server/wm/OWNERS
+include /services/core/java/com/android/server/wm/OWNERS
diff --git a/core/java/com/android/ims/OWNERS b/core/java/com/android/ims/OWNERS
new file mode 100644
index 0000000..640baf2
--- /dev/null
+++ b/core/java/com/android/ims/OWNERS
@@ -0,0 +1 @@
+include /telephony/OWNERS
diff --git a/core/java/com/android/internal/config/sysui/OWNERS b/core/java/com/android/internal/config/sysui/OWNERS
new file mode 100644
index 0000000..2e96c97
--- /dev/null
+++ b/core/java/com/android/internal/config/sysui/OWNERS
@@ -0,0 +1 @@
+include /packages/SystemUI/OWNERS
diff --git a/core/java/com/android/internal/net/OWNERS b/core/java/com/android/internal/net/OWNERS
index 050cb5c..fec56c3 100644
--- a/core/java/com/android/internal/net/OWNERS
+++ b/core/java/com/android/internal/net/OWNERS
@@ -3,7 +3,7 @@
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/core/java/com/android/internal/os/OWNERS b/core/java/com/android/internal/os/OWNERS
index afc9432..633d093 100644
--- a/core/java/com/android/internal/os/OWNERS
+++ b/core/java/com/android/internal/os/OWNERS
@@ -1 +1 @@
-per-file ZygoteArguments.java,ZygoteConnection.java,ZygoteInit.java,Zygote.java,ZygoteServer.java = [email protected], [email protected], [email protected], [email protected], [email protected]
+per-file *Zygote* = file:/ZYGOTE_OWNERS
diff --git a/core/java/com/android/internal/policy/OWNERS b/core/java/com/android/internal/policy/OWNERS
new file mode 100644
index 0000000..0862c05
--- /dev/null
+++ b/core/java/com/android/internal/policy/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/wm/OWNERS
diff --git a/core/java/com/android/internal/statusbar/OWNERS b/core/java/com/android/internal/statusbar/OWNERS
new file mode 100644
index 0000000..2e96c97
--- /dev/null
+++ b/core/java/com/android/internal/statusbar/OWNERS
@@ -0,0 +1 @@
+include /packages/SystemUI/OWNERS
diff --git a/core/jni/OWNERS b/core/jni/OWNERS
index 7d80993..bcd1278 100644
--- a/core/jni/OWNERS
+++ b/core/jni/OWNERS
@@ -16,5 +16,21 @@
per-file android_view_*MotionEvent.* = [email protected], [email protected]
per-file android_view_PointerIcon.* = [email protected], [email protected]
-# Zygote
-per-file com_android_internal_os_Zygote.*,fd_utils.* = [email protected], [email protected], [email protected], [email protected], [email protected]
+per-file *Zygote* = file:/ZYGOTE_OWNERS
+per-file Android.bp = file:platform/build/soong:/OWNERS
+per-file android_animation_* = file:/core/java/android/animation/OWNERS
+per-file android_app_admin_* = file:/core/java/android/app/admin/OWNERS
+per-file android_content_res_* = file:/core/java/android/content/res/OWNERS
+per-file android_graphics_* = file:/graphics/java/android/graphics/OWNERS
+per-file android_hardware_Usb* = file:/services/usb/OWNERS
+per-file android_hardware_display_* = file:/core/java/android/hardware/display/OWNERS
+per-file android_hardware_input_* = file:/core/java/android/hardware/input/OWNERS
+per-file android_hardware_location_* = file:/core/java/android/hardware/location/OWNERS
+per-file android_media_* = file:/media/java/android/media/OWNERS
+per-file android_media_midi_* = file:/media/java/android/media/midi/OWNERS
+per-file android_opengl_* = file:/opengl/java/android/opengl/OWNERS
+per-file android_os_storage_* = file:/core/java/android/os/storage/OWNERS
+per-file android_se_* = file:/core/java/android/se/OWNERS
+per-file android_security_* = file:/core/java/android/security/OWNERS
+per-file android_view_* = file:/core/java/android/view/OWNERS
+per-file com_android_internal_net_* = file:/services/core/java/com/android/server/net/OWNERS
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 1250eb7..849ab0a 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -2212,6 +2212,13 @@
<permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE"
android:protectionLevel="signature|privileged" />
+ <!-- Allows to read device identifiers and use ICC based authentication like EAP-AKA.
+ Often required in authentication to access the carrier's server and manage services
+ of the subscriber.
+ <p>Protection level: signature|appop -->
+ <permission android:name="android.permission.USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER"
+ android:protectionLevel="signature|appop" />
+
<!-- @SystemApi Allows read access to emergency number information for ongoing calls or SMS
sessions.
@hide Used internally. -->
diff --git a/core/res/OWNERS b/core/res/OWNERS
new file mode 100644
index 0000000..263d638
--- /dev/null
+++ b/core/res/OWNERS
@@ -0,0 +1,17 @@
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/core/tests/ConnectivityManagerTest/OWNERS b/core/tests/ConnectivityManagerTest/OWNERS
new file mode 100644
index 0000000..aa87958
--- /dev/null
+++ b/core/tests/ConnectivityManagerTest/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/net/OWNERS
diff --git a/core/tests/PackageInstallerSessions/OWNERS b/core/tests/PackageInstallerSessions/OWNERS
new file mode 100644
index 0000000..d825dfd
--- /dev/null
+++ b/core/tests/PackageInstallerSessions/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/pm/OWNERS
diff --git a/core/tests/benchmarks/src/android/net/OWNERS b/core/tests/benchmarks/src/android/net/OWNERS
new file mode 100644
index 0000000..aa87958
--- /dev/null
+++ b/core/tests/benchmarks/src/android/net/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/net/OWNERS
diff --git a/core/tests/bluetoothtests/OWNERS b/core/tests/bluetoothtests/OWNERS
new file mode 100644
index 0000000..98bb877
--- /dev/null
+++ b/core/tests/bluetoothtests/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/bluetooth/OWNERS
diff --git a/core/tests/coretests/apks/OWNERS b/core/tests/coretests/apks/OWNERS
new file mode 100644
index 0000000..d825dfd
--- /dev/null
+++ b/core/tests/coretests/apks/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/pm/OWNERS
diff --git a/core/tests/coretests/src/android/accessibilityservice/OWNERS b/core/tests/coretests/src/android/accessibilityservice/OWNERS
new file mode 100644
index 0000000..b74281e
--- /dev/null
+++ b/core/tests/coretests/src/android/accessibilityservice/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/view/accessibility/OWNERS
diff --git a/core/tests/coretests/src/android/database/OWNERS b/core/tests/coretests/src/android/database/OWNERS
new file mode 100644
index 0000000..bb9a2ca
--- /dev/null
+++ b/core/tests/coretests/src/android/database/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/database/OWNERS
diff --git a/core/tests/coretests/src/android/net/OWNERS b/core/tests/coretests/src/android/net/OWNERS
new file mode 100644
index 0000000..aa87958
--- /dev/null
+++ b/core/tests/coretests/src/android/net/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/net/OWNERS
diff --git a/core/tests/coretests/src/com/android/internal/accessibility/OWNERS b/core/tests/coretests/src/com/android/internal/accessibility/OWNERS
new file mode 100644
index 0000000..b74281e
--- /dev/null
+++ b/core/tests/coretests/src/com/android/internal/accessibility/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/view/accessibility/OWNERS
diff --git a/core/tests/coretests/src/com/android/internal/inputmethod/OWNERS b/core/tests/coretests/src/com/android/internal/inputmethod/OWNERS
new file mode 100644
index 0000000..5deb2ce
--- /dev/null
+++ b/core/tests/coretests/src/com/android/internal/inputmethod/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/view/inputmethod/OWNERS
diff --git a/core/tests/coretests/src/com/android/internal/policy/OWNERS b/core/tests/coretests/src/com/android/internal/policy/OWNERS
new file mode 100644
index 0000000..0862c05
--- /dev/null
+++ b/core/tests/coretests/src/com/android/internal/policy/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/wm/OWNERS
diff --git a/core/tests/coretests/src/com/android/internal/power/OWNERS b/core/tests/coretests/src/com/android/internal/power/OWNERS
new file mode 100644
index 0000000..d68066b
--- /dev/null
+++ b/core/tests/coretests/src/com/android/internal/power/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/power/OWNERS
diff --git a/core/tests/coretests/src/com/android/internal/statusbar/OWNERS b/core/tests/coretests/src/com/android/internal/statusbar/OWNERS
new file mode 100644
index 0000000..2e96c97
--- /dev/null
+++ b/core/tests/coretests/src/com/android/internal/statusbar/OWNERS
@@ -0,0 +1 @@
+include /packages/SystemUI/OWNERS
diff --git a/core/tests/devicestatetests/src/android/hardware/devicestate/OWNERS b/core/tests/devicestatetests/src/android/hardware/devicestate/OWNERS
new file mode 100644
index 0000000..d9b0e2e
--- /dev/null
+++ b/core/tests/devicestatetests/src/android/hardware/devicestate/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/devicestate/OWNERS
diff --git a/core/tests/hdmitests/OWNERS b/core/tests/hdmitests/OWNERS
new file mode 100644
index 0000000..c3c47ed
--- /dev/null
+++ b/core/tests/hdmitests/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/hardware/hdmi/OWNERS
diff --git a/core/tests/hosttests/test-apps/OWNERS b/core/tests/hosttests/test-apps/OWNERS
new file mode 100644
index 0000000..d825dfd
--- /dev/null
+++ b/core/tests/hosttests/test-apps/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/pm/OWNERS
diff --git a/core/tests/notificationtests/OWNERS b/core/tests/notificationtests/OWNERS
new file mode 100644
index 0000000..396fd12
--- /dev/null
+++ b/core/tests/notificationtests/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/notification/OWNERS
diff --git a/core/tests/overlaytests/OWNERS b/core/tests/overlaytests/OWNERS
new file mode 100644
index 0000000..afb98d4
--- /dev/null
+++ b/core/tests/overlaytests/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/content/om/OWNERS
diff --git a/core/tests/packagemanagertests/OWNERS b/core/tests/packagemanagertests/OWNERS
new file mode 100644
index 0000000..d825dfd
--- /dev/null
+++ b/core/tests/packagemanagertests/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/pm/OWNERS
diff --git a/core/tests/powertests/OWNERS b/core/tests/powertests/OWNERS
new file mode 100644
index 0000000..d68066b
--- /dev/null
+++ b/core/tests/powertests/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/power/OWNERS
diff --git a/data/etc/OWNERS b/data/etc/OWNERS
index 70d4678..5efd0bd 100644
--- a/data/etc/OWNERS
+++ b/data/etc/OWNERS
@@ -1 +1,13 @@
-per-file privapp-permissions-platform.xml = [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/data/etc/car/OWNERS b/data/etc/car/OWNERS
new file mode 100644
index 0000000..09e257c
--- /dev/null
+++ b/data/etc/car/OWNERS
@@ -0,0 +1 @@
+include platform/packages/services/Car:/OWNERS
diff --git a/data/fonts/OWNERS b/data/fonts/OWNERS
new file mode 100644
index 0000000..a538331
--- /dev/null
+++ b/data/fonts/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/graphics/fonts/OWNERS
diff --git a/drm/java/android/drm/OWNERS b/drm/java/android/drm/OWNERS
new file mode 100644
index 0000000..4387100
--- /dev/null
+++ b/drm/java/android/drm/OWNERS
@@ -0,0 +1,4 @@
+# Bug component: 49079
+
[email protected]
[email protected]
diff --git a/errorprone/OWNERS b/errorprone/OWNERS
new file mode 100644
index 0000000..bddbdb3
--- /dev/null
+++ b/errorprone/OWNERS
@@ -0,0 +1,2 @@
[email protected]
[email protected]
diff --git a/graphics/OWNERS b/graphics/OWNERS
new file mode 100644
index 0000000..a6d1bc3
--- /dev/null
+++ b/graphics/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/graphics/OWNERS
diff --git a/graphics/java/android/graphics/OWNERS b/graphics/java/android/graphics/OWNERS
new file mode 100644
index 0000000..6196889
--- /dev/null
+++ b/graphics/java/android/graphics/OWNERS
@@ -0,0 +1,6 @@
+# Bug component: 24939
+
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/graphics/java/android/graphics/drawable/OWNERS b/graphics/java/android/graphics/drawable/OWNERS
new file mode 100644
index 0000000..6196889
--- /dev/null
+++ b/graphics/java/android/graphics/drawable/OWNERS
@@ -0,0 +1,6 @@
+# Bug component: 24939
+
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/graphics/java/android/graphics/drawable/shapes/OWNERS b/graphics/java/android/graphics/drawable/shapes/OWNERS
new file mode 100644
index 0000000..6196889
--- /dev/null
+++ b/graphics/java/android/graphics/drawable/shapes/OWNERS
@@ -0,0 +1,6 @@
+# Bug component: 24939
+
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/graphics/java/android/graphics/fonts/OWNERS b/graphics/java/android/graphics/fonts/OWNERS
new file mode 100644
index 0000000..e0a354e
--- /dev/null
+++ b/graphics/java/android/graphics/fonts/OWNERS
@@ -0,0 +1,5 @@
+# Bug component: 24939
+
[email protected]
[email protected]
[email protected]
diff --git a/graphics/java/android/graphics/pdf/OWNERS b/graphics/java/android/graphics/pdf/OWNERS
new file mode 100644
index 0000000..f04e200
--- /dev/null
+++ b/graphics/java/android/graphics/pdf/OWNERS
@@ -0,0 +1,8 @@
+# Bug component: 24939
+
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/graphics/java/android/graphics/text/OWNERS b/graphics/java/android/graphics/text/OWNERS
new file mode 100644
index 0000000..e0a354e
--- /dev/null
+++ b/graphics/java/android/graphics/text/OWNERS
@@ -0,0 +1,5 @@
+# Bug component: 24939
+
[email protected]
[email protected]
[email protected]
diff --git a/keystore/java/android/security/IKeyChainService.aidl b/keystore/java/android/security/IKeyChainService.aidl
index add52fa..a9d4094 100644
--- a/keystore/java/android/security/IKeyChainService.aidl
+++ b/keystore/java/android/security/IKeyChainService.aidl
@@ -49,6 +49,7 @@
in byte[] privateKey, in byte[] userCert, in byte[] certChain, String alias, int uid);
boolean removeKeyPair(String alias);
boolean containsKeyPair(String alias);
+ int[] getGrants(String alias);
// APIs used by Settings
boolean deleteCaCertificate(String alias);
diff --git a/libs/WindowManager/OWNERS b/libs/WindowManager/OWNERS
index 063d459..2c61df9 100644
--- a/libs/WindowManager/OWNERS
+++ b/libs/WindowManager/OWNERS
@@ -1,3 +1,3 @@
set noparent
-include ../../services/core/java/com/android/server/wm/OWNERS
\ No newline at end of file
+include /services/core/java/com/android/server/wm/OWNERS
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitWindowManager.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitWindowManager.java
index 542867d..e412198 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitWindowManager.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitWindowManager.java
@@ -22,6 +22,7 @@
import static android.view.WindowManager.LayoutParams.FLAG_SPLIT_TOUCH;
import static android.view.WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION;
+import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_TRUSTED_OVERLAY;
import static android.view.WindowManager.LayoutParams.TYPE_DOCK_DIVIDER;
import android.content.Context;
@@ -89,7 +90,7 @@
PixelFormat.TRANSLUCENT);
lp.token = new Binder();
lp.setTitle(DIVIDER_WINDOW_TITLE);
- lp.privateFlags |= PRIVATE_FLAG_NO_MOVE_ANIMATION;
+ lp.privateFlags |= PRIVATE_FLAG_NO_MOVE_ANIMATION | PRIVATE_FLAG_TRUSTED_OVERLAY;
mViewHost.setView(dividerView, lp);
dividerView.setup(splitLayout, mViewHost, null /* dragListener */);
}
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/draganddrop/DragAndDropController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/draganddrop/DragAndDropController.java
index 625c0a7..a89c8bb 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/draganddrop/DragAndDropController.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/draganddrop/DragAndDropController.java
@@ -54,7 +54,6 @@
import com.android.wm.shell.protolog.ShellProtoLogGroup;
import com.android.wm.shell.splitscreen.SplitScreen;
-import java.util.Objects;
import java.util.Optional;
/**
@@ -108,16 +107,22 @@
DragLayout dragLayout = new DragLayout(context, mSplitScreen);
rootView.addView(dragLayout,
new FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
- wm.addView(rootView, layoutParams);
-
- mDisplayDropTargets.put(displayId,
- new PerDisplay(displayId, context, wm, rootView, dragLayout));
+ try {
+ wm.addView(rootView, layoutParams);
+ mDisplayDropTargets.put(displayId,
+ new PerDisplay(displayId, context, wm, rootView, dragLayout));
+ } catch (WindowManager.InvalidDisplayException e) {
+ Slog.w(TAG, "Unable to add view for display id: " + displayId);
+ }
}
@Override
public void onDisplayConfigurationChanged(int displayId, Configuration newConfig) {
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_DRAG_AND_DROP, "Display changed: %d", displayId);
final PerDisplay pd = mDisplayDropTargets.get(displayId);
+ if (pd == null) {
+ return;
+ }
pd.rootView.requestApplyInsets();
}
@@ -125,6 +130,9 @@
public void onDisplayRemoved(int displayId) {
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_DRAG_AND_DROP, "Display removed: %d", displayId);
final PerDisplay pd = mDisplayDropTargets.get(displayId);
+ if (pd == null) {
+ return;
+ }
pd.wm.removeViewImmediate(pd.rootView);
mDisplayDropTargets.remove(displayId);
}
@@ -139,6 +147,10 @@
final PerDisplay pd = mDisplayDropTargets.get(displayId);
final ClipDescription description = event.getClipDescription();
+ if (pd == null) {
+ return false;
+ }
+
if (event.getAction() == ACTION_DRAG_STARTED) {
final boolean hasValidClipData = event.getClipData().getItemCount() > 0
&& (description.hasMimeType(MIMETYPE_APPLICATION_ACTIVITY)
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PinnedStackListenerForwarder.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PinnedStackListenerForwarder.java
index 5593268..d59aec2 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PinnedStackListenerForwarder.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PinnedStackListenerForwarder.java
@@ -20,7 +20,6 @@
import android.content.ComponentName;
import android.content.pm.ParceledListSlice;
import android.os.RemoteException;
-import android.view.DisplayInfo;
import android.view.IPinnedStackListener;
import android.view.WindowManagerGlobal;
@@ -85,18 +84,6 @@
}
}
- private void onDisplayInfoChanged(DisplayInfo displayInfo) {
- for (PinnedStackListener listener : mListeners) {
- listener.onDisplayInfoChanged(displayInfo);
- }
- }
-
- private void onConfigurationChanged() {
- for (PinnedStackListener listener : mListeners) {
- listener.onConfigurationChanged();
- }
- }
-
private void onAspectRatioChanged(float aspectRatio) {
for (PinnedStackListener listener : mListeners) {
listener.onAspectRatioChanged(aspectRatio);
@@ -134,20 +121,6 @@
}
@Override
- public void onDisplayInfoChanged(DisplayInfo displayInfo) {
- mShellMainExecutor.execute(() -> {
- PinnedStackListenerForwarder.this.onDisplayInfoChanged(displayInfo);
- });
- }
-
- @Override
- public void onConfigurationChanged() {
- mShellMainExecutor.execute(() -> {
- PinnedStackListenerForwarder.this.onConfigurationChanged();
- });
- }
-
- @Override
public void onAspectRatioChanged(float aspectRatio) {
mShellMainExecutor.execute(() -> {
PinnedStackListenerForwarder.this.onAspectRatioChanged(aspectRatio);
@@ -168,10 +141,6 @@
public void onActivityHidden(ComponentName componentName) {}
- public void onDisplayInfoChanged(DisplayInfo displayInfo) {}
-
- public void onConfigurationChanged() {}
-
public void onAspectRatioChanged(float aspectRatio) {}
}
}
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/Pip.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/Pip.java
index da9ce0a..1f07542 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/Pip.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/Pip.java
@@ -20,6 +20,7 @@
import android.app.PictureInPictureParams;
import android.content.ComponentName;
import android.content.pm.ActivityInfo;
+import android.content.res.Configuration;
import android.graphics.Rect;
import com.android.wm.shell.common.annotations.ExternalThread;
@@ -82,6 +83,12 @@
}
/**
+ * Called when configuration is changed.
+ */
+ default void onConfigurationChanged(Configuration newConfig) {
+ }
+
+ /**
* Called when display size or font size of settings changed
*/
default void onDensityOrFontScaleChanged() {
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipBoundsAlgorithm.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipBoundsAlgorithm.java
index 1bb5eda..22d8ed5 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipBoundsAlgorithm.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipBoundsAlgorithm.java
@@ -102,9 +102,7 @@
return mSnapAlgorithm;
}
- /**
- * Responds to IPinnedStackListener on configuration change.
- */
+ /** Responds to configuration change. */
public void onConfigurationChanged(Context context) {
reloadResources(context);
}
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java
index 167b9f9..9081783 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java
@@ -502,7 +502,6 @@
mPipMenuController.attach(leash);
-
if (mShouldIgnoreEnteringPipTransition) {
final Rect destinationBounds = mPipBoundsState.getBounds();
// animation is finished in the Launcher and here we directly apply the final touch.
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java
index 3234ef6..46fff85 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java
@@ -33,6 +33,7 @@
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.content.pm.ParceledListSlice;
+import android.content.res.Configuration;
import android.graphics.Rect;
import android.os.RemoteException;
import android.os.UserHandle;
@@ -104,6 +105,9 @@
// Skip if we aren't in PIP or haven't actually entered PIP yet. We still need to update
// the display layout in the bounds handler in this case.
onDisplayRotationChangedNotInPip(mContext, toRotation);
+ // do not forget to update the movement bounds as well.
+ updateMovementBounds(mPipBoundsState.getNormalBounds(), true /* fromRotation */,
+ false /* fromImeAdjustment */, false /* fromShelfAdjustment */, t);
return;
}
// If there is an animation running (ie. from a shelf offset), then ensure that we calculate
@@ -136,7 +140,7 @@
}
};
- private DisplayController.OnDisplaysChangedListener mFixedRotationListener =
+ private final DisplayController.OnDisplaysChangedListener mFixedRotationListener =
new DisplayController.OnDisplaysChangedListener() {
@Override
public void onFixedRotationStarted(int displayId, int newRotation) {
@@ -188,18 +192,6 @@
}
@Override
- public void onDisplayInfoChanged(DisplayInfo displayInfo) {
- mPipBoundsState.setDisplayInfo(displayInfo);
- }
-
- @Override
- public void onConfigurationChanged() {
- mPipBoundsAlgorithm.onConfigurationChanged(mContext);
- mTouchHandler.onConfigurationChanged();
- mPipBoundsState.onConfigurationChanged();
- }
-
- @Override
public void onAspectRatioChanged(float aspectRatio) {
// TODO(b/169373982): Remove this callback as it is redundant with PipTaskOrg params
// change.
@@ -334,6 +326,15 @@
}
@Override
+ public void onConfigurationChanged(Configuration newConfig) {
+ mMainExecutor.execute(() -> {
+ mPipBoundsAlgorithm.onConfigurationChanged(mContext);
+ mTouchHandler.onConfigurationChanged();
+ mPipBoundsState.onConfigurationChanged();
+ });
+ }
+
+ @Override
public void onDensityOrFontScaleChanged() {
mMainExecutor.execute(() -> {
mPipTaskOrganizer.onDensityOrFontScaleChanged(mContext);
@@ -532,7 +533,7 @@
*
* @return {@code true} if internal {@link DisplayInfo} is rotated, {@code false} otherwise.
*/
- public boolean onDisplayRotationChanged(Context context, Rect outBounds, Rect oldBounds,
+ private boolean onDisplayRotationChanged(Context context, Rect outBounds, Rect oldBounds,
Rect outInsetBounds,
int displayId, int fromRotation, int toRotation, WindowContainerTransaction t) {
// Bail early if the event is not sent to current {@link #mDisplayInfo}
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipResizeGestureHandler.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipResizeGestureHandler.java
index 88a1168..2f5219c 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipResizeGestureHandler.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipResizeGestureHandler.java
@@ -93,6 +93,7 @@
private int mDelta;
private float mTouchSlop;
+
private boolean mAllowGesture;
private boolean mIsAttached;
private boolean mIsEnabled;
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipTouchHandler.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipTouchHandler.java
index 9281f58..33439a4 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipTouchHandler.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipTouchHandler.java
@@ -86,7 +86,7 @@
private boolean mEnableStash = true;
// The reference inset bounds, used to determine the dismiss fraction
- private Rect mInsetBounds = new Rect();
+ private final Rect mInsetBounds = new Rect();
private int mExpandedShortestEdgeSize;
// Used to workaround an issue where the WM rotation happens before we are notified, allowing
@@ -94,7 +94,8 @@
private int mDeferResizeToNormalBoundsUntilRotation = -1;
private int mDisplayRotation;
- private Handler mHandler = new Handler();
+ private final Handler mHandler = new Handler();
+ private final PipAccessibilityInteractionConnection mConnection;
// Behaviour states
private int mMenuState = MENU_STATE_NONE;
@@ -108,7 +109,6 @@
private float mSavedSnapFraction = -1f;
private boolean mSendingHoverAccessibilityEvents;
private boolean mMovementWithinDismiss;
- private PipAccessibilityInteractionConnection mConnection;
// Touch state
private final PipTouchState mTouchState;
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/PipController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/PipController.java
index 763370b..0955056 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/PipController.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/PipController.java
@@ -37,7 +37,6 @@
import android.content.pm.ParceledListSlice;
import android.content.res.Configuration;
import android.graphics.Rect;
-import android.os.Debug;
import android.os.Handler;
import android.os.RemoteException;
import android.os.UserHandle;
@@ -56,8 +55,6 @@
import com.android.wm.shell.pip.PipMediaController;
import com.android.wm.shell.pip.PipTaskOrganizer;
-import java.util.ArrayList;
-import java.util.List;
import java.util.Objects;
/**
@@ -87,42 +84,21 @@
private static final int TASK_ID_NO_PIP = -1;
private static final int INVALID_RESOURCE_TYPE = -1;
- public static final int SUSPEND_PIP_RESIZE_REASON_WAITING_FOR_MENU_ACTIVITY_FINISH = 0x1;
-
- /**
- * PIPed activity is playing a media and it can be paused.
- */
- static final int PLAYBACK_STATE_PLAYING = 0;
- /**
- * PIPed activity has a paused media and it can be played.
- */
- static final int PLAYBACK_STATE_PAUSED = 1;
- /**
- * Users are unable to control PIPed activity's media playback.
- */
- static final int PLAYBACK_STATE_UNAVAILABLE = 2;
-
- private static final int CLOSE_PIP_WHEN_MEDIA_SESSION_GONE_TIMEOUT_MS = 3000;
-
- private int mSuspendPipResizingReason;
-
private final Context mContext;
private final PipBoundsState mPipBoundsState;
private final PipBoundsAlgorithm mPipBoundsAlgorithm;
private final PipTaskOrganizer mPipTaskOrganizer;
private final PipMediaController mPipMediaController;
private final TvPipMenuController mTvPipMenuController;
+ private final PipNotification mPipNotification;
private IActivityTaskManager mActivityTaskManager;
private int mState = STATE_NO_PIP;
- private int mResumeResizePinnedStackRunnableState = STATE_NO_PIP;
private final Handler mHandler = new Handler();
- private List<Listener> mListeners = new ArrayList<>();
private int mLastOrientation = Configuration.ORIENTATION_UNDEFINED;
private int mPipTaskId = TASK_ID_NO_PIP;
private int mPinnedStackId = INVALID_STACK_ID;
private String[] mLastPackagesResourceGranted;
- private PipNotification mPipNotification;
private ParceledListSlice<RemoteAction> mCustomActions;
private WindowManagerShellWrapper mWindowManagerShellWrapper;
private int mResizeAnimationDuration;
@@ -135,9 +111,7 @@
private boolean mImeVisible;
private int mImeHeightAdjustment;
- private final Runnable mResizePinnedStackRunnable =
- () -> resizePinnedStack(mResumeResizePinnedStackRunnableState);
- private final Runnable mClosePipRunnable = () -> closePip();
+ private final Runnable mClosePipRunnable = this::closePip;
private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
@@ -237,8 +211,6 @@
mPipTaskOrganizer.registerPipTransitionCallback(this);
mActivityTaskManager = ActivityTaskManager.getService();
- addListener(mPipNotification);
-
final IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(ACTION_CLOSE);
intentFilter.addAction(ACTION_MENU);
@@ -297,6 +269,7 @@
/**
* Updates the PIP per configuration changed.
*/
+ @Override
public void onConfigurationChanged(Configuration newConfig) {
loadConfigurationsAndApply(newConfig);
mPipNotification.onConfigurationChanged(mContext);
@@ -340,9 +313,8 @@
mPinnedStackId = INVALID_STACK_ID;
}
}
- for (int i = mListeners.size() - 1; i >= 0; --i) {
- mListeners.get(i).onPipActivityClosed();
- }
+ mPipNotification.dismiss();
+ mTvPipMenuController.hideMenu();
mHandler.removeCallbacks(mClosePipRunnable);
}
@@ -353,9 +325,9 @@
if (DEBUG) Log.d(TAG, "movePipToFullscreen(), current state=" + getStateDescription());
mPipTaskId = TASK_ID_NO_PIP;
- for (int i = mListeners.size() - 1; i >= 0; --i) {
- mListeners.get(i).onMoveToFullscreen();
- }
+ mTvPipMenuController.hideMenu();
+ mPipNotification.dismiss();
+
resizePinnedStack(STATE_NO_PIP);
}
@@ -379,9 +351,7 @@
// Set state to STATE_PIP so we show it when the pinned stack animation ends.
mState = STATE_PIP;
mPipMediaController.onActivityPinned();
- for (int i = mListeners.size() - 1; i >= 0; i--) {
- mListeners.get(i).onPipEntered(packageName);
- }
+ mPipNotification.show(packageName);
}
private void onActivityRestartAttempt(ActivityManager.RunningTaskInfo task,
@@ -428,61 +398,17 @@
}
/**
- * Suspends resizing operation on the Pip until {@link #resumePipResizing} is called
- *
- * @param reason The reason for suspending resizing operations on the Pip.
- */
- public void suspendPipResizing(int reason) {
- if (DEBUG) {
- Log.d(TAG,
- "suspendPipResizing() reason=" + reason + " callers=" + Debug.getCallers(2));
- }
- mSuspendPipResizingReason |= reason;
- }
-
- /**
- * Resumes resizing operation on the Pip that was previously suspended.
- *
- * @param reason The reason resizing operations on the Pip was suspended.
- */
- public void resumePipResizing(int reason) {
- if ((mSuspendPipResizingReason & reason) == 0) {
- return;
- }
- if (DEBUG) {
- Log.d(TAG,
- "resumePipResizing() reason=" + reason + " callers=" + Debug.getCallers(2));
- }
- mSuspendPipResizingReason &= ~reason;
- mHandler.post(mResizePinnedStackRunnable);
- }
-
- /**
* Resize the Pip to the appropriate size for the input state.
*
* @param state In Pip state also used to determine the new size for the Pip.
*/
public void resizePinnedStack(int state) {
-
if (DEBUG) {
Log.d(TAG, "resizePinnedStack() state=" + stateToName(state) + ", current state="
+ getStateDescription(), new Exception());
}
-
- boolean wasStateNoPip = (mState == STATE_NO_PIP);
- for (int i = mListeners.size() - 1; i >= 0; --i) {
- mListeners.get(i).onPipResizeAboutToStart();
- }
- if (mSuspendPipResizingReason != 0) {
- mResumeResizePinnedStackRunnableState = state;
- if (DEBUG) {
- Log.d(TAG, "resizePinnedStack() deferring"
- + " mSuspendPipResizingReason=" + mSuspendPipResizingReason
- + " mResumeResizePinnedStackRunnableState="
- + stateToName(mResumeResizePinnedStackRunnableState));
- }
- return;
- }
+ final boolean wasStateNoPip = (mState == STATE_NO_PIP);
+ mTvPipMenuController.hideMenu();
mState = state;
final Rect newBounds;
switch (mState) {
@@ -510,45 +436,20 @@
}
/**
- * @return the current state, or the pending state if the state change was previously suspended.
+ * @return the current state.
*/
private int getState() {
- if (mSuspendPipResizingReason != 0) {
- return mResumeResizePinnedStackRunnableState;
- }
return mState;
}
- /**
- * Shows PIP menu UI by launching {@link PipMenuActivity}. It also locates the pinned
- * stack to the centered PIP bound {@link R.config_centeredPictureInPictureBounds}.
- */
private void showPipMenu() {
if (DEBUG) Log.d(TAG, "showPipMenu(), current state=" + getStateDescription());
mState = STATE_PIP_MENU;
- for (int i = mListeners.size() - 1; i >= 0; --i) {
- mListeners.get(i).onShowPipMenu();
- }
-
mTvPipMenuController.showMenu();
}
/**
- * Adds a {@link Listener} to PipController.
- */
- void addListener(Listener listener) {
- mListeners.add(listener);
- }
-
- /**
- * Removes a {@link Listener} from PipController.
- */
- void removeListener(Listener listener) {
- mListeners.remove(listener);
- }
-
- /**
* Returns {@code true} if PIP is shown.
*/
public boolean isPipShown() {
@@ -619,33 +520,8 @@
}
}
- /**
- * A listener interface to receive notification on changes in PIP.
- */
- public interface Listener {
- /**
- * Invoked when an activity is pinned and PIP manager is set corresponding information.
- * Classes must use this instead of {@link android.app.ITaskStackListener.onActivityPinned}
- * because there's no guarantee for the PIP manager be return relavent information
- * correctly. (e.g. {@link Pip.isPipShown}).
- */
- void onPipEntered(String packageName);
- /** Invoked when a PIPed activity is closed. */
- void onPipActivityClosed();
- /** Invoked when the PIP menu gets shown. */
- void onShowPipMenu();
- /** Invoked when the PIPed activity is about to return back to the fullscreen. */
- void onMoveToFullscreen();
- /** Invoked when we are above to start resizing the Pip. */
- void onPipResizeAboutToStart();
- }
-
private String getStateDescription() {
- if (mSuspendPipResizingReason == 0) {
- return stateToName(mState);
- }
- return stateToName(mResumeResizePinnedStackRunnableState) + " (while " + stateToName(mState)
- + " is suspended)";
+ return stateToName(mState);
}
private static String stateToName(int state) {
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/PipMenuView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/PipMenuView.java
index 689c3ed..83cb7ce 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/PipMenuView.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/PipMenuView.java
@@ -16,6 +16,9 @@
package com.android.wm.shell.pip.tv;
+import static android.view.KeyEvent.ACTION_UP;
+import static android.view.KeyEvent.KEYCODE_BACK;
+
import android.animation.Animator;
import android.animation.AnimatorInflater;
import android.annotation.Nullable;
@@ -36,25 +39,22 @@
/**
* The Menu View that shows controls of the PiP. Always fullscreen.
*/
-public class PipMenuView extends FrameLayout implements PipController.Listener {
+public class PipMenuView extends FrameLayout {
private static final String TAG = "PipMenuView";
private static final boolean DEBUG = PipController.DEBUG;
- private final PipController mPipController;
private final Animator mFadeInAnimation;
private final Animator mFadeOutAnimation;
private final PipControlsViewController mPipControlsViewController;
- private boolean mRestorePipSizeWhenClose;
+ @Nullable
+ private OnBackPressListener mOnBackPressListener;
public PipMenuView(Context context, PipController pipController) {
super(context, null, 0);
- mPipController = pipController;
-
inflate(context, R.layout.tv_pip_menu, this);
mPipControlsViewController = new PipControlsViewController(
- findViewById(R.id.pip_controls), mPipController);
- mRestorePipSizeWhenClose = true;
+ findViewById(R.id.pip_controls), pipController);
mFadeInAnimation = AnimatorInflater.loadAnimator(
mContext, R.anim.tv_pip_menu_fade_in_animation);
mFadeInAnimation.setTarget(mPipControlsViewController.getView());
@@ -63,16 +63,6 @@
mFadeOutAnimation.setTarget(mPipControlsViewController.getView());
}
- @Override
- public boolean dispatchKeyEvent(KeyEvent event) {
- if (event.getKeyCode() == KeyEvent.KEYCODE_BACK
- && event.getAction() == KeyEvent.ACTION_UP) {
- restorePipAndFinish();
- return true;
- }
- return super.dispatchKeyEvent(event);
- }
-
@Nullable
SurfaceControl getWindowSurfaceControl() {
final ViewRootImpl root = getViewRootImpl();
@@ -87,53 +77,39 @@
}
void showMenu() {
- mPipController.addListener(this);
mFadeInAnimation.start();
setAlpha(1.0f);
- try {
- WindowManagerGlobal.getWindowSession().grantEmbeddedWindowFocus(null /* window */,
- getViewRootImpl().getInputToken(), true /* grantFocus */);
- } catch (Exception e) {
- Log.e(TAG, "Unable to update focus as menu appears", e);
- }
+ grantWindowFocus(true);
}
void hideMenu() {
- mPipController.removeListener(this);
- mPipController.resumePipResizing(
- PipController.SUSPEND_PIP_RESIZE_REASON_WAITING_FOR_MENU_ACTIVITY_FINISH);
mFadeOutAnimation.start();
setAlpha(0.0f);
+ grantWindowFocus(false);
+ }
+
+ private void grantWindowFocus(boolean grantFocus) {
try {
WindowManagerGlobal.getWindowSession().grantEmbeddedWindowFocus(null /* window */,
- getViewRootImpl().getInputToken(), false /* grantFocus */);
+ getViewRootImpl().getInputToken(), grantFocus);
} catch (Exception e) {
Log.e(TAG, "Unable to update focus as menu disappears", e);
}
}
- private void restorePipAndFinish() {
- if (DEBUG) Log.d(TAG, "restorePipAndFinish()");
+ void setOnBackPressListener(OnBackPressListener onBackPressListener) {
+ mOnBackPressListener = onBackPressListener;
+ }
- if (mRestorePipSizeWhenClose) {
- if (DEBUG) Log.d(TAG, " > restoring to the default position");
-
- // When PIP menu activity is closed, restore to the default position.
- mPipController.resizePinnedStack(PipController.STATE_PIP);
+ @Override
+ public boolean dispatchKeyEvent(KeyEvent event) {
+ if (event.getKeyCode() == KEYCODE_BACK && event.getAction() == ACTION_UP
+ && mOnBackPressListener != null) {
+ mOnBackPressListener.onBackPress();
+ return true;
+ } else {
+ return super.dispatchKeyEvent(event);
}
- hideMenu();
- }
-
- @Override
- public void onPipEntered(String packageName) {
- if (DEBUG) Log.d(TAG, "onPipEntered(), packageName=" + packageName);
- }
-
- @Override
- public void onPipActivityClosed() {
- if (DEBUG) Log.d(TAG, "onPipActivityClosed()");
-
- hideMenu();
}
void setAppActions(ParceledListSlice<RemoteAction> actions) {
@@ -144,27 +120,7 @@
hasCustomActions ? actions.getList() : Collections.emptyList());
}
- @Override
- public void onShowPipMenu() {
- if (DEBUG) Log.d(TAG, "onShowPipMenu()");
- }
-
- @Override
- public void onMoveToFullscreen() {
- if (DEBUG) Log.d(TAG, "onMoveToFullscreen()");
-
- // Moving PIP to fullscreen is implemented by resizing PINNED_STACK with null bounds.
- // This conflicts with restoring PIP position, so disable it.
- mRestorePipSizeWhenClose = false;
- hideMenu();
- }
-
- @Override
- public void onPipResizeAboutToStart() {
- if (DEBUG) Log.d(TAG, "onPipResizeAboutToStart()");
-
- hideMenu();
- mPipController.suspendPipResizing(
- PipController.SUSPEND_PIP_RESIZE_REASON_WAITING_FOR_MENU_ACTIVITY_FINISH);
+ interface OnBackPressListener {
+ void onBackPress();
}
}
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/PipNotification.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/PipNotification.java
index d56a888..4e0ab66 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/PipNotification.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/PipNotification.java
@@ -39,7 +39,7 @@
* <p>Once it's created, it will manage the PIP notification UI by itself except for handling
* configuration changes.
*/
-public class PipNotification implements PipController.Listener {
+public class PipNotification {
private static final boolean DEBUG = PipController.DEBUG;
private static final String TAG = "PipNotification";
@@ -79,38 +79,21 @@
onConfigurationChanged(context);
}
- @Override
- public void onPipEntered(String packageName) {
+ void show(String packageName) {
mPackageName = packageName;
- notifyPipNotification();
+ update();
}
- @Override
- public void onPipActivityClosed() {
- dismissPipNotification();
+ void dismiss() {
+ mNotificationManager.cancel(NOTIFICATION_TAG, SystemMessage.NOTE_TV_PIP);
+ mNotified = false;
mPackageName = null;
}
- @Override
- public void onShowPipMenu() {
- // no-op.
- }
-
- @Override
- public void onMoveToFullscreen() {
- dismissPipNotification();
- mPackageName = null;
- }
-
- @Override
- public void onPipResizeAboutToStart() {
- // no-op.
- }
-
private void onMediaMetadataChanged(MediaMetadata metadata) {
if (updateMediaControllerMetadata(metadata) && mNotified) {
// update notification
- notifyPipNotification();
+ update();
}
}
@@ -123,11 +106,11 @@
mDefaultIconResId = R.drawable.pip_icon;
if (mNotified) {
// update notification
- notifyPipNotification();
+ update();
}
}
- private void notifyPipNotification() {
+ private void update() {
mNotified = true;
mNotificationBuilder
.setShowWhen(true)
@@ -144,11 +127,6 @@
mNotificationBuilder.build());
}
- private void dismissPipNotification() {
- mNotified = false;
- mNotificationManager.cancel(NOTIFICATION_TAG, SystemMessage.NOTE_TV_PIP);
- }
-
private boolean updateMediaControllerMetadata(MediaMetadata metadata) {
String title = null;
Bitmap art = null;
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipMenuController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipMenuController.java
index 91aef67..5d0d761 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipMenuController.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipMenuController.java
@@ -21,6 +21,7 @@
import android.app.RemoteAction;
import android.content.Context;
import android.content.pm.ParceledListSlice;
+import android.util.Log;
import android.view.SurfaceControl;
import com.android.wm.shell.common.SystemWindows;
@@ -31,6 +32,8 @@
* Manages the visibility of the PiP Menu as user interacts with PiP.
*/
public class TvPipMenuController implements PipMenuController {
+ private static final String TAG = "TvPipMenuController";
+ private static final boolean DEBUG = PipController.DEBUG;
private final Context mContext;
private final SystemWindows mSystemWindows;
@@ -52,6 +55,8 @@
@Override
public void showMenu() {
+ if (DEBUG) Log.d(TAG, "showMenu()");
+
if (mMenuView != null) {
mSystemWindows.updateViewLayout(mMenuView, getPipMenuLayoutParams(MENU_WINDOW_TITLE,
mPipBoundsState.getDisplayBounds().width(),
@@ -68,27 +73,62 @@
}
}
- @Override
- public void attach(SurfaceControl leash) {
- if (mMenuView == null) {
- mMenuView = new PipMenuView(mContext, mPipController);
- mSystemWindows.addView(mMenuView,
- getPipMenuLayoutParams(MENU_WINDOW_TITLE, 0 /* width */, 0 /* height */),
- 0, SHELL_ROOT_LAYER_PIP);
- mLeash = leash;
+ void hideMenu() {
+ if (DEBUG) Log.d(TAG, "hideMenu()");
+
+ if (isMenuVisible()) {
+ mMenuView.hideMenu();
+ mPipController.resizePinnedStack(PipController.STATE_PIP);
}
}
@Override
+ public void attach(SurfaceControl leash) {
+ mLeash = leash;
+ attachPipMenuView();
+ }
+
+ @Override
public void detach() {
+ hideMenu();
+ detachPipMenuView();
+ mLeash = null;
+ }
+
+ private void attachPipMenuView() {
+ if (DEBUG) Log.d(TAG, "attachPipMenuView()");
+
+ if (mMenuView != null) {
+ detachPipMenuView();
+ }
+
+ mMenuView = new PipMenuView(mContext, mPipController);
+ mMenuView.setOnBackPressListener(this::hideMenu);
+ mSystemWindows.addView(mMenuView,
+ getPipMenuLayoutParams(MENU_WINDOW_TITLE, 0 /* width */, 0 /* height */),
+ 0, SHELL_ROOT_LAYER_PIP);
+ }
+
+ private void detachPipMenuView() {
+ if (DEBUG) Log.d(TAG, "detachPipMenuView()");
+
+ if (mMenuView == null) {
+ return;
+ }
+
mSystemWindows.removeView(mMenuView);
mMenuView = null;
- mLeash = null;
}
@Override
public void setAppActions(ParceledListSlice<RemoteAction> appActions) {
- mMenuView.setAppActions(appActions);
+ if (DEBUG) Log.d(TAG, "setAppActions(), actions=" + appActions);
+
+ if (mMenuView != null) {
+ mMenuView.setAppActions(appActions);
+ } else {
+ Log.w(TAG, "Cannot set remote actions, there is no View");
+ }
}
@Override
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/DividerWindowManager.java b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/DividerWindowManager.java
index f2becc9..5078371 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/DividerWindowManager.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/DividerWindowManager.java
@@ -24,6 +24,7 @@
import static android.view.WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH;
import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION;
+import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_TRUSTED_OVERLAY;
import static android.view.WindowManager.LayoutParams.TYPE_DOCK_DIVIDER;
import static android.view.WindowManager.SHELL_ROOT_LAYER_DIVIDER;
@@ -59,7 +60,7 @@
PixelFormat.TRANSLUCENT);
mLp.token = new Binder();
mLp.setTitle(WINDOW_TITLE);
- mLp.privateFlags |= PRIVATE_FLAG_NO_MOVE_ANIMATION;
+ mLp.privateFlags |= PRIVATE_FLAG_NO_MOVE_ANIMATION | PRIVATE_FLAG_TRUSTED_OVERLAY;
mLp.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
diff --git a/libs/hwui/FrameInfo.h b/libs/hwui/FrameInfo.h
index 738246d..ee7d15a 100644
--- a/libs/hwui/FrameInfo.h
+++ b/libs/hwui/FrameInfo.h
@@ -159,7 +159,7 @@
// GPU start time is approximated to the moment before swapBuffer is invoked.
// We could add an EGLSyncKHR fence at the beginning of the frame, but that is an overhead.
int64_t endTime = get(FrameInfoIndex::GpuCompleted);
- return endTime > 0 ? endTime - get(FrameInfoIndex::SwapBuffers) : 0;
+ return endTime > 0 ? endTime - get(FrameInfoIndex::SwapBuffers) : -1;
}
inline int64_t& set(FrameInfoIndex index) { return mFrameInfo[static_cast<int>(index)]; }
diff --git a/libs/incident/OWNERS b/libs/incident/OWNERS
new file mode 100644
index 0000000..f766115
--- /dev/null
+++ b/libs/incident/OWNERS
@@ -0,0 +1 @@
+include /cmds/incidentd/OWNERS
diff --git a/libs/input/OWNERS b/libs/input/OWNERS
new file mode 100644
index 0000000..d701f23
--- /dev/null
+++ b/libs/input/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/hardware/input/OWNERS
diff --git a/libs/storage/OWNERS b/libs/storage/OWNERS
new file mode 100644
index 0000000..6f9dbea
--- /dev/null
+++ b/libs/storage/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/os/storage/OWNERS
diff --git a/libs/usb/OWNERS b/libs/usb/OWNERS
new file mode 100644
index 0000000..f7b2a37
--- /dev/null
+++ b/libs/usb/OWNERS
@@ -0,0 +1 @@
+include /services/usb/OWNERS
diff --git a/location/OWNERS b/location/OWNERS
new file mode 100644
index 0000000..5ac60284
--- /dev/null
+++ b/location/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/location/OWNERS
diff --git a/location/java/android/location/OWNERS b/location/java/android/location/OWNERS
new file mode 100644
index 0000000..383321b
--- /dev/null
+++ b/location/java/android/location/OWNERS
@@ -0,0 +1,6 @@
+# Bug component: 880425
+
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/media/OWNERS b/media/OWNERS
index e741490..b2875e7 100644
--- a/media/OWNERS
+++ b/media/OWNERS
@@ -10,7 +10,7 @@
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java
index 4578883..c67d90a 100644
--- a/media/java/android/media/AudioManager.java
+++ b/media/java/android/media/AudioManager.java
@@ -2881,7 +2881,12 @@
* @return true if any music tracks are active.
*/
public boolean isMusicActive() {
- return AudioSystem.isStreamActive(STREAM_MUSIC, 0);
+ final IAudioService service = getService();
+ try {
+ return service.isMusicActive();
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
}
/**
diff --git a/media/java/android/media/AudioPlaybackConfiguration.java b/media/java/android/media/AudioPlaybackConfiguration.java
index 515e9d0..17305a5 100644
--- a/media/java/android/media/AudioPlaybackConfiguration.java
+++ b/media/java/android/media/AudioPlaybackConfiguration.java
@@ -89,9 +89,8 @@
/**
* @hide
* Player backed an AAudio player.
- * Note this type is not in System API so it will not be returned in public API calls
*/
- // TODO unhide for SystemApi, update getPlayerType()
+ @SystemApi
public static final int PLAYER_TYPE_AAUDIO = 13;
/**
@@ -280,10 +279,7 @@
/**
* @hide
- * Return the type of player linked to this configuration. The return value is one of
- * {@link #PLAYER_TYPE_JAM_AUDIOTRACK}, {@link #PLAYER_TYPE_JAM_MEDIAPLAYER},
- * {@link #PLAYER_TYPE_JAM_SOUNDPOOL}, {@link #PLAYER_TYPE_SLES_AUDIOPLAYER_BUFFERQUEUE},
- * {@link #PLAYER_TYPE_SLES_AUDIOPLAYER_URI_FD}, or {@link #PLAYER_TYPE_UNKNOWN}.
+ * Return the type of player linked to this configuration.
* <br>Note that player types not exposed in the system API will be represented as
* {@link #PLAYER_TYPE_UNKNOWN}.
* @return the type of the player.
@@ -291,7 +287,6 @@
@SystemApi
public @PlayerType int getPlayerType() {
switch (mPlayerType) {
- case PLAYER_TYPE_AAUDIO:
case PLAYER_TYPE_HW_SOURCE:
case PLAYER_TYPE_EXTERNAL_PROXY:
return PLAYER_TYPE_UNKNOWN;
diff --git a/media/java/android/media/IAudioService.aidl b/media/java/android/media/IAudioService.aidl
index 5c012be..2ac5b50 100755
--- a/media/java/android/media/IAudioService.aidl
+++ b/media/java/android/media/IAudioService.aidl
@@ -334,4 +334,6 @@
oneway void setStreamVolumeForUid(int streamType, int direction, int flags,
in String packageName, int uid, int pid, in UserHandle userHandle,
int targetSdkVersion);
+
+ boolean isMusicActive();
}
diff --git a/media/java/android/media/MediaHTTPConnection.java b/media/java/android/media/MediaHTTPConnection.java
index a17ff82..babc1d5 100644
--- a/media/java/android/media/MediaHTTPConnection.java
+++ b/media/java/android/media/MediaHTTPConnection.java
@@ -19,7 +19,7 @@
import static android.media.MediaPlayer.MEDIA_ERROR_UNSUPPORTED;
import android.compat.annotation.UnsupportedAppUsage;
-import android.net.NetworkUtils;
+import android.net.InetAddresses;
import android.os.IBinder;
import android.os.StrictMode;
import android.util.Log;
@@ -214,7 +214,7 @@
if (host.equalsIgnoreCase("localhost")) {
return true;
}
- if (NetworkUtils.numericToInetAddress(host).isLoopbackAddress()) {
+ if (InetAddresses.parseNumericAddress(host).isLoopbackAddress()) {
return true;
}
} catch (IllegalArgumentException iex) {
diff --git a/media/java/android/media/OWNERS b/media/java/android/media/OWNERS
new file mode 100644
index 0000000..cbc9ab7
--- /dev/null
+++ b/media/java/android/media/OWNERS
@@ -0,0 +1,8 @@
+# Bug component: 1344
+
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/media/java/android/media/audiofx/OWNERS b/media/java/android/media/audiofx/OWNERS
new file mode 100644
index 0000000..189fe0f
--- /dev/null
+++ b/media/java/android/media/audiofx/OWNERS
@@ -0,0 +1,3 @@
+# Bug component: 48436
+
[email protected]
diff --git a/media/java/android/media/audiopolicy/OWNERS b/media/java/android/media/audiopolicy/OWNERS
new file mode 100644
index 0000000..189fe0f
--- /dev/null
+++ b/media/java/android/media/audiopolicy/OWNERS
@@ -0,0 +1,3 @@
+# Bug component: 48436
+
[email protected]
diff --git a/media/java/android/media/browse/OWNERS b/media/java/android/media/browse/OWNERS
new file mode 100644
index 0000000..916fc36
--- /dev/null
+++ b/media/java/android/media/browse/OWNERS
@@ -0,0 +1,8 @@
+# Bug component: 137631
+
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/media/java/android/media/midi/OWNERS b/media/java/android/media/midi/OWNERS
new file mode 100644
index 0000000..6a351d3
--- /dev/null
+++ b/media/java/android/media/midi/OWNERS
@@ -0,0 +1 @@
[email protected]
diff --git a/media/java/android/media/session/OWNERS b/media/java/android/media/session/OWNERS
new file mode 100644
index 0000000..916fc36
--- /dev/null
+++ b/media/java/android/media/session/OWNERS
@@ -0,0 +1,8 @@
+# Bug component: 137631
+
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/media/java/android/media/soundtrigger/OWNERS b/media/java/android/media/soundtrigger/OWNERS
new file mode 100644
index 0000000..6a351d3
--- /dev/null
+++ b/media/java/android/media/soundtrigger/OWNERS
@@ -0,0 +1 @@
[email protected]
diff --git a/media/java/android/media/tv/OWNERS b/media/java/android/media/tv/OWNERS
index a891154..8bccc9a 100644
--- a/media/java/android/media/tv/OWNERS
+++ b/media/java/android/media/tv/OWNERS
@@ -1,9 +1,6 @@
[email protected]
[email protected]
[email protected]
[email protected]
# For android remote service
per-file ITvRemoteServiceInput.aidl = file:/media/lib/tvremote/OWNERS
per-file ITvRemoteProvider.aidl = file:/media/lib/tvremote/OWNERS
-
diff --git a/media/java/android/media/tv/tuner/frontend/DvbsFrontendSettings.java b/media/java/android/media/tv/tuner/frontend/DvbsFrontendSettings.java
index 98f8096..a2a602a 100644
--- a/media/java/android/media/tv/tuner/frontend/DvbsFrontendSettings.java
+++ b/media/java/android/media/tv/tuner/frontend/DvbsFrontendSettings.java
@@ -341,13 +341,13 @@
return mScanType;
}
/**
- * Get if the client could handle the Diseqc Rx Message or not. Default value is false.
+ * Get if the client can handle the Diseqc Rx Message or not. Default value is false.
*
- * The setter {@link Builder#setCouldHandleDiseqcRxMessage(boolean)} is only supported with
+ * The setter {@link Builder#setCanHandleDiseqcRxMessage(boolean)} is only supported with
* Tuner HAL 1.1 or higher. Use {@link TunerVersionChecker.getTunerVersion()} to check the
* version.
*/
- public boolean getCouldHandleDiseqcRxMessage() {
+ public boolean canHandleDiseqcRxMessage() {
return mIsDiseqcRxMessage;
}
@@ -409,7 +409,7 @@
}
/**
- * Set true to indicate the client could handle the Diseqc Messages. Note that it's still
+ * Set true to indicate the client can handle the Diseqc Messages. Note that it's still
* possible that the client won't receive the messages when HAL is not able to setup Rx
* channel in the hardware layer.
*
@@ -417,10 +417,10 @@
* no-op. Use {@link TunerVersionChecker.getTunerVersion()} to check the version.
*/
@NonNull
- public Builder setCouldHandleDiseqcRxMessage(boolean couldReceiveDiseqcMessage) {
+ public Builder setCanHandleDiseqcRxMessage(boolean canHandleDiseqcMessage) {
if (TunerVersionChecker.checkHigherOrEqualVersionTo(
- TunerVersionChecker.TUNER_VERSION_1_1, "setCouldHandleDiseqcRxMessage")) {
- mIsDiseqcRxMessage = couldReceiveDiseqcMessage;
+ TunerVersionChecker.TUNER_VERSION_1_1, "setCanHandleDiseqcRxMessage")) {
+ mIsDiseqcRxMessage = canHandleDiseqcMessage;
}
return this;
}
diff --git a/media/java/android/mtp/OWNERS b/media/java/android/mtp/OWNERS
index 1928ba8..e27d06f 100644
--- a/media/java/android/mtp/OWNERS
+++ b/media/java/android/mtp/OWNERS
@@ -1,7 +1,7 @@
set noparent
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/media/jni/OWNERS b/media/jni/OWNERS
index f1b0237..e6e4f86 100644
--- a/media/jni/OWNERS
+++ b/media/jni/OWNERS
@@ -1,5 +1,5 @@
# extra for MTP related files
-per-file android_mtp_*[email protected],[email protected],[email protected],[email protected]
+per-file android_mtp_*[email protected],[email protected],[email protected],[email protected]
# extra for TV related files
per-file android_media_tv_*[email protected],[email protected]
diff --git a/media/mca/effect/java/android/media/effect/OWNERS b/media/mca/effect/java/android/media/effect/OWNERS
new file mode 100644
index 0000000..6a351d3
--- /dev/null
+++ b/media/mca/effect/java/android/media/effect/OWNERS
@@ -0,0 +1 @@
[email protected]
diff --git a/media/mca/effect/java/android/media/effect/effects/OWNERS b/media/mca/effect/java/android/media/effect/effects/OWNERS
new file mode 100644
index 0000000..6a351d3
--- /dev/null
+++ b/media/mca/effect/java/android/media/effect/effects/OWNERS
@@ -0,0 +1 @@
[email protected]
diff --git a/media/mca/filterfw/java/android/filterfw/OWNERS b/media/mca/filterfw/java/android/filterfw/OWNERS
new file mode 100644
index 0000000..5d351ef
--- /dev/null
+++ b/media/mca/filterfw/java/android/filterfw/OWNERS
@@ -0,0 +1,3 @@
+# Bug component: 50018
+
[email protected]
diff --git a/media/mca/filterfw/java/android/filterfw/samples/OWNERS b/media/mca/filterfw/java/android/filterfw/samples/OWNERS
new file mode 100644
index 0000000..5d351ef
--- /dev/null
+++ b/media/mca/filterfw/java/android/filterfw/samples/OWNERS
@@ -0,0 +1,3 @@
+# Bug component: 50018
+
[email protected]
diff --git a/media/tests/MtpTests/OWNERS b/media/tests/MtpTests/OWNERS
index 1928ba8..e27d06f 100644
--- a/media/tests/MtpTests/OWNERS
+++ b/media/tests/MtpTests/OWNERS
@@ -1,7 +1,7 @@
set noparent
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/mime/OWNERS b/mime/OWNERS
new file mode 100644
index 0000000..6f9dbea
--- /dev/null
+++ b/mime/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/os/storage/OWNERS
diff --git a/mime/java-res/android.mime.types b/mime/java-res/android.mime.types
index e5273a9..92365d1 100644
--- a/mime/java-res/android.mime.types
+++ b/mime/java-res/android.mime.types
@@ -63,6 +63,7 @@
?application/x-android-drm-fl fl
?application/x-flac flac
?application/x-font pcf
+?application/x-mobipocket-ebook prc mobi
?application/x-mpegurl m3u m3u8
?application/x-pem-file pem
?application/x-pkcs12 p12 pfx
diff --git a/native/android/aidl/com/android/internal/compat/OWNERS b/native/android/aidl/com/android/internal/compat/OWNERS
new file mode 100644
index 0000000..f8c3520
--- /dev/null
+++ b/native/android/aidl/com/android/internal/compat/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/compat/OWNERS
diff --git a/native/graphics/OWNERS b/native/graphics/OWNERS
new file mode 100644
index 0000000..a6d1bc3
--- /dev/null
+++ b/native/graphics/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/graphics/OWNERS
diff --git a/opengl/java/android/opengl/OWNERS b/opengl/java/android/opengl/OWNERS
new file mode 100644
index 0000000..9c6c610
--- /dev/null
+++ b/opengl/java/android/opengl/OWNERS
@@ -0,0 +1,4 @@
+# Bug component: 25421
+
[email protected]
[email protected]
diff --git a/packages/AppPredictionLib/OWNERS b/packages/AppPredictionLib/OWNERS
new file mode 100644
index 0000000..3a5d23d
--- /dev/null
+++ b/packages/AppPredictionLib/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/service/appprediction/OWNERS
diff --git a/packages/Backup/OWNERS b/packages/Backup/OWNERS
new file mode 100644
index 0000000..d99779e
--- /dev/null
+++ b/packages/Backup/OWNERS
@@ -0,0 +1 @@
+include /services/backup/OWNERS
diff --git a/packages/BackupEncryption/OWNERS b/packages/BackupEncryption/OWNERS
new file mode 100644
index 0000000..d99779e
--- /dev/null
+++ b/packages/BackupEncryption/OWNERS
@@ -0,0 +1 @@
+include /services/backup/OWNERS
diff --git a/packages/BackupRestoreConfirmation/OWNERS b/packages/BackupRestoreConfirmation/OWNERS
new file mode 100644
index 0000000..d99779e
--- /dev/null
+++ b/packages/BackupRestoreConfirmation/OWNERS
@@ -0,0 +1 @@
+include /services/backup/OWNERS
diff --git a/packages/EasterEgg/OWNERS b/packages/EasterEgg/OWNERS
new file mode 100644
index 0000000..2e96c97
--- /dev/null
+++ b/packages/EasterEgg/OWNERS
@@ -0,0 +1 @@
+include /packages/SystemUI/OWNERS
diff --git a/packages/ExternalStorageProvider/OWNERS b/packages/ExternalStorageProvider/OWNERS
new file mode 100644
index 0000000..6f9dbea
--- /dev/null
+++ b/packages/ExternalStorageProvider/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/os/storage/OWNERS
diff --git a/packages/FusedLocation/OWNERS b/packages/FusedLocation/OWNERS
new file mode 100644
index 0000000..5ac60284
--- /dev/null
+++ b/packages/FusedLocation/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/location/OWNERS
diff --git a/packages/MtpDocumentsProvider/OWNERS b/packages/MtpDocumentsProvider/OWNERS
new file mode 100644
index 0000000..6f9dbea
--- /dev/null
+++ b/packages/MtpDocumentsProvider/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/os/storage/OWNERS
diff --git a/packages/PrintRecommendationService/OWNERS b/packages/PrintRecommendationService/OWNERS
new file mode 100644
index 0000000..2c7b881
--- /dev/null
+++ b/packages/PrintRecommendationService/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/print/OWNERS
diff --git a/packages/PrintSpooler/OWNERS b/packages/PrintSpooler/OWNERS
new file mode 100644
index 0000000..2c7b881
--- /dev/null
+++ b/packages/PrintSpooler/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/print/OWNERS
diff --git a/packages/SettingsLib/Android.bp b/packages/SettingsLib/Android.bp
index e6492aa..23cb36f 100644
--- a/packages/SettingsLib/Android.bp
+++ b/packages/SettingsLib/Android.bp
@@ -54,6 +54,7 @@
"SettingsLibEmergencyNumber",
"SettingsLibTopIntroPreference",
"SettingsLibBannerMessagePreference",
+ "SettingsLibFooterPreference",
],
}
diff --git a/packages/SettingsLib/FooterPreference/Android.bp b/packages/SettingsLib/FooterPreference/Android.bp
new file mode 100644
index 0000000..30d9bd2
--- /dev/null
+++ b/packages/SettingsLib/FooterPreference/Android.bp
@@ -0,0 +1,13 @@
+android_library {
+ name: "SettingsLibFooterPreference",
+
+ srcs: ["src/**/*.java"],
+ resource_dirs: ["res"],
+
+ static_libs: [
+ "androidx.annotation_annotation",
+ "androidx.preference_preference",
+ ],
+ sdk_version: "system_current",
+ min_sdk_version: "21",
+}
diff --git a/packages/SettingsLib/FooterPreference/AndroidManifest.xml b/packages/SettingsLib/FooterPreference/AndroidManifest.xml
new file mode 100644
index 0000000..96d9e51
--- /dev/null
+++ b/packages/SettingsLib/FooterPreference/AndroidManifest.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2020 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.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.settingslib.widget">
+
+ <uses-sdk android:minSdkVersion="21" />
+
+</manifest>
diff --git a/packages/SettingsLib/res/drawable/ic_info_outline_24.xml b/packages/SettingsLib/FooterPreference/res/drawable/ic_info_outline_24.xml
similarity index 95%
rename from packages/SettingsLib/res/drawable/ic_info_outline_24.xml
rename to packages/SettingsLib/FooterPreference/res/drawable/ic_info_outline_24.xml
index 317e43b..d9afeb0 100644
--- a/packages/SettingsLib/res/drawable/ic_info_outline_24.xml
+++ b/packages/SettingsLib/FooterPreference/res/drawable/ic_info_outline_24.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- Copyright (C) 2019 The Android Open Source Project
+ Copyright (C) 2020 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/packages/SystemUI/res/color/qs_background_dark.xml b/packages/SettingsLib/FooterPreference/res/values/attrs.xml
similarity index 72%
rename from packages/SystemUI/res/color/qs_background_dark.xml
rename to packages/SettingsLib/FooterPreference/res/values/attrs.xml
index c47959a..deba3af 100644
--- a/packages/SystemUI/res/color/qs_background_dark.xml
+++ b/packages/SettingsLib/FooterPreference/res/values/attrs.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2017 The Android Open Source Project
+<!-- Copyright (C) 2020 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,7 +14,6 @@
limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:alpha="1"
- android:color="?android:attr/colorBackground"/>
-</selector>
+<resources>
+ <attr name="footerPreferenceStyle" format="reference" />
+</resources>
\ No newline at end of file
diff --git a/packages/SettingsLib/src/com/android/settingslib/widget/FooterPreference.java b/packages/SettingsLib/FooterPreference/src/com/android/settingslib/widget/FooterPreference.java
similarity index 96%
rename from packages/SettingsLib/src/com/android/settingslib/widget/FooterPreference.java
rename to packages/SettingsLib/FooterPreference/src/com/android/settingslib/widget/FooterPreference.java
index 1557618..15301f6 100644
--- a/packages/SettingsLib/src/com/android/settingslib/widget/FooterPreference.java
+++ b/packages/SettingsLib/FooterPreference/src/com/android/settingslib/widget/FooterPreference.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2020 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,7 +16,6 @@
package com.android.settingslib.widget;
-import android.annotation.StringRes;
import android.content.Context;
import android.text.TextUtils;
import android.text.method.LinkMovementMethod;
@@ -24,20 +23,19 @@
import android.widget.TextView;
import androidx.annotation.NonNull;
+import androidx.annotation.StringRes;
import androidx.core.content.res.TypedArrayUtils;
import androidx.preference.Preference;
import androidx.preference.PreferenceViewHolder;
-import com.android.settingslib.R;
-
/**
* A custom preference acting as "footer" of a page. It has a field for icon and text. It is added
* to screen as the last preference.
*/
public class FooterPreference extends Preference {
- static final int ORDER_FOOTER = Integer.MAX_VALUE - 1;
public static final String KEY_FOOTER = "footer_preference";
+ static final int ORDER_FOOTER = Integer.MAX_VALUE - 1;
public FooterPreference(Context context, AttributeSet attrs) {
super(context, attrs, TypedArrayUtils.getAttr(
diff --git a/packages/SettingsLib/OWNERS b/packages/SettingsLib/OWNERS
index 8eafbdf..30c10d3 100644
--- a/packages/SettingsLib/OWNERS
+++ b/packages/SettingsLib/OWNERS
@@ -1,5 +1,5 @@
# People who can approve changes for submission
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/packages/SettingsLib/res/values/attrs.xml b/packages/SettingsLib/res/values/attrs.xml
index 9aed54e..1e6cb33 100644
--- a/packages/SettingsLib/res/values/attrs.xml
+++ b/packages/SettingsLib/res/values/attrs.xml
@@ -46,8 +46,6 @@
<attr name="wifi_signal" format="reference" />
<attr name="wifi_friction" format="reference" />
- <attr name="footerPreferenceStyle" format="reference" />
-
<!-- Workaround for b/74248169. These are duplicates of attrs in AndroidX preferences. -->
<attr name="preferenceStyle" format="reference" />
<attr name="switchPreferenceStyle" format="reference" />
diff --git a/packages/SettingsLib/src/com/android/settingslib/media/MediaDevice.java b/packages/SettingsLib/src/com/android/settingslib/media/MediaDevice.java
index 41d6afc..f21c359 100644
--- a/packages/SettingsLib/src/com/android/settingslib/media/MediaDevice.java
+++ b/packages/SettingsLib/src/com/android/settingslib/media/MediaDevice.java
@@ -38,6 +38,7 @@
import android.media.MediaRoute2Info;
import android.media.MediaRouter2Manager;
import android.text.TextUtils;
+import android.util.Log;
import androidx.annotation.IntDef;
import androidx.annotation.VisibleForTesting;
@@ -46,6 +47,7 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
+import java.util.ArrayList;
import java.util.List;
/**
@@ -199,6 +201,10 @@
*/
public void requestSetVolume(int volume) {
+ if (mRouteInfo == null) {
+ Log.w(TAG, "Unable to set volume. RouteInfo is empty");
+ return;
+ }
mRouterManager.setRouteVolume(mRouteInfo, volume);
}
@@ -208,6 +214,10 @@
* @return max volume.
*/
public int getMaxVolume() {
+ if (mRouteInfo == null) {
+ Log.w(TAG, "Unable to get max volume. RouteInfo is empty");
+ return 0;
+ }
return mRouteInfo.getVolumeMax();
}
@@ -217,6 +227,10 @@
* @return current volume.
*/
public int getCurrentVolume() {
+ if (mRouteInfo == null) {
+ Log.w(TAG, "Unable to get current volume. RouteInfo is empty");
+ return 0;
+ }
return mRouteInfo.getVolume();
}
@@ -226,6 +240,10 @@
* @return package name.
*/
public String getClientPackageName() {
+ if (mRouteInfo == null) {
+ Log.w(TAG, "Unable to get client package name. RouteInfo is empty");
+ return null;
+ }
return mRouteInfo.getClientPackageName();
}
@@ -244,6 +262,10 @@
* @return result of transfer media
*/
public boolean connect() {
+ if (mRouteInfo == null) {
+ Log.w(TAG, "Unable to connect. RouteInfo is empty");
+ return false;
+ }
setConnectedRecord();
mRouterManager.selectRoute(mPackageName, mRouteInfo);
return true;
@@ -358,6 +380,10 @@
* Gets the supported features of the route.
*/
public List<String> getFeatures() {
+ if (mRouteInfo == null) {
+ Log.w(TAG, "Unable to get features. RouteInfo is empty");
+ return new ArrayList<>();
+ }
return mRouteInfo.getFeatures();
}
diff --git a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/media/MediaDeviceTest.java b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/media/MediaDeviceTest.java
index 47d4beb..6f7f73a 100644
--- a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/media/MediaDeviceTest.java
+++ b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/media/MediaDeviceTest.java
@@ -465,4 +465,12 @@
assertThat(mInfoMediaDevice1.getState()).isEqualTo(
LocalMediaManager.MediaDeviceState.STATE_CONNECTING_FAILED);
}
+
+ @Test
+ public void getFeatures_noRouteInfo_returnEmptyList() {
+ mBluetoothMediaDevice1 = new BluetoothMediaDevice(mContext, mCachedDevice1,
+ mMediaRouter2Manager, null /* MediaRoute2Info */, TEST_PACKAGE_NAME);
+
+ assertThat(mBluetoothMediaDevice1.getFeatures().size()).isEqualTo(0);
+ }
}
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
index 271f2a7..c9e3b6f 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
@@ -3342,7 +3342,7 @@
}
private final class UpgradeController {
- private static final int SETTINGS_VERSION = 195;
+ private static final int SETTINGS_VERSION = 196;
private final int mUserId;
diff --git a/packages/SharedStorageBackup/OWNERS b/packages/SharedStorageBackup/OWNERS
new file mode 100644
index 0000000..d99779e
--- /dev/null
+++ b/packages/SharedStorageBackup/OWNERS
@@ -0,0 +1 @@
+include /services/backup/OWNERS
diff --git a/packages/Shell/OWNERS b/packages/Shell/OWNERS
index 6ba1fcb..2d7a3e6 100644
--- a/packages/Shell/OWNERS
+++ b/packages/Shell/OWNERS
@@ -1,6 +1,6 @@
set noparent
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml
index 2da958f..285c4a1 100644
--- a/packages/SystemUI/AndroidManifest.xml
+++ b/packages/SystemUI/AndroidManifest.xml
@@ -576,6 +576,7 @@
android:launchMode="singleInstance">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
+ <action android:name="android.appwidget.action.APPWIDGET_CONFIGURE"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
diff --git a/packages/SystemUI/OWNERS b/packages/SystemUI/OWNERS
index f884270..3bda710 100644
--- a/packages/SystemUI/OWNERS
+++ b/packages/SystemUI/OWNERS
@@ -1,6 +1,6 @@
set noparent
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/packages/SystemUI/res/drawable/brightness_mirror_background.xml b/packages/SystemUI/res/drawable/brightness_mirror_background.xml
index 43c9b73..02261b2 100644
--- a/packages/SystemUI/res/drawable/brightness_mirror_background.xml
+++ b/packages/SystemUI/res/drawable/brightness_mirror_background.xml
@@ -15,6 +15,6 @@
~ limitations under the License
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android">
- <solid android:color="@color/qs_background_dark" />
+ <solid android:color="?android:attr/colorBackground" />
<corners android:radius="8dp" />
</shape>
diff --git a/packages/SystemUI/res/drawable/ic_open_in_new_fullscreen.xml b/packages/SystemUI/res/drawable/ic_open_in_new_fullscreen.xml
index 55116c6..9f66581d 100644
--- a/packages/SystemUI/res/drawable/ic_open_in_new_fullscreen.xml
+++ b/packages/SystemUI/res/drawable/ic_open_in_new_fullscreen.xml
@@ -19,8 +19,8 @@
<shape android:shape="rectangle">
<solid android:color="@color/magnification_switch_button_color" />
<size
- android:width="40dp"
- android:height="40dp" />
+ android:width="48dp"
+ android:height="48dp" />
</shape>
</item>
diff --git a/packages/SystemUI/res/drawable/ic_open_in_new_window.xml b/packages/SystemUI/res/drawable/ic_open_in_new_window.xml
index 5f571cf..659b020 100644
--- a/packages/SystemUI/res/drawable/ic_open_in_new_window.xml
+++ b/packages/SystemUI/res/drawable/ic_open_in_new_window.xml
@@ -19,8 +19,8 @@
<shape android:shape="rectangle">
<solid android:color="@color/magnification_switch_button_color" />
<size
- android:width="40dp"
- android:height="40dp" />
+ android:width="48dp"
+ android:height="48dp" />
</shape>
</item>
diff --git a/packages/SystemUI/res/drawable/people_space_activity_card.xml b/packages/SystemUI/res/drawable/people_space_activity_card.xml
new file mode 100644
index 0000000..81162d2
--- /dev/null
+++ b/packages/SystemUI/res/drawable/people_space_activity_card.xml
@@ -0,0 +1,19 @@
+<!--
+ ~ Copyright (C) 2020 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.
+ -->
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <solid android:color="?android:attr/colorAccent" />
+ <corners android:radius="@dimen/people_space_widget_radius" />
+</shape>
\ No newline at end of file
diff --git a/packages/SystemUI/res/drawable/people_space_content_background.xml b/packages/SystemUI/res/drawable/people_space_content_background.xml
new file mode 100644
index 0000000..53108409
--- /dev/null
+++ b/packages/SystemUI/res/drawable/people_space_content_background.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2020 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.
+ -->
+<shape xmlns:android="http://schemas.android.com/apk/res/android" >
+ <solid android:color="?android:attr/colorControlHighlight" />
+ <corners android:radius="@dimen/people_space_widget_radius" />
+</shape>
diff --git a/packages/SystemUI/res/drawable/people_space_round_tile_view_card.xml b/packages/SystemUI/res/drawable/people_space_round_tile_view_card.xml
new file mode 100644
index 0000000..59af775
--- /dev/null
+++ b/packages/SystemUI/res/drawable/people_space_round_tile_view_card.xml
@@ -0,0 +1,19 @@
+<!--
+ ~ Copyright (C) 2020 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.
+ -->
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <solid android:color="?android:attr/colorBackground" />
+ <corners android:radius="@dimen/people_space_widget_round_radius" />
+</shape>
\ No newline at end of file
diff --git a/packages/SystemUI/res/drawable/people_space_rounded_border.xml b/packages/SystemUI/res/drawable/people_space_rounded_border.xml
new file mode 100644
index 0000000..9956bc2
--- /dev/null
+++ b/packages/SystemUI/res/drawable/people_space_rounded_border.xml
@@ -0,0 +1,19 @@
+<!--
+ ~ Copyright (C) 2020 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.
+ -->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="oval">
+ <solid android:color="?android:attr/colorBackground" />
+</shape>
\ No newline at end of file
diff --git a/packages/SystemUI/res/drawable/people_space_tile_view_card.xml b/packages/SystemUI/res/drawable/people_space_tile_view_card.xml
index 4772ae7..8fd4388 100644
--- a/packages/SystemUI/res/drawable/people_space_tile_view_card.xml
+++ b/packages/SystemUI/res/drawable/people_space_tile_view_card.xml
@@ -14,6 +14,6 @@
~ limitations under the License.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android">
- <solid android:color="@android:color/white" />
+ <solid android:color="?android:attr/colorBackground" />
<corners android:radius="@dimen/people_space_widget_radius" />
</shape>
\ No newline at end of file
diff --git a/packages/SystemUI/res/drawable/people_space_widget_background.xml b/packages/SystemUI/res/drawable/people_space_widget_background.xml
index b929359..fa45718 100644
--- a/packages/SystemUI/res/drawable/people_space_widget_background.xml
+++ b/packages/SystemUI/res/drawable/people_space_widget_background.xml
@@ -18,7 +18,7 @@
android:shape="rectangle" >
<solid
android:color="?android:attr/colorControlNormal" />
- <corners android:radius="@dimen/people_space_widget_radius" />
+ <corners android:radius="@dimen/people_space_widget_background_padding" />
<padding
android:left="@dimen/people_space_widget_background_padding"
android:top="@dimen/people_space_widget_background_padding"
diff --git a/packages/SystemUI/res/drawable/qs_background_primary.xml b/packages/SystemUI/res/drawable/qs_background_primary.xml
deleted file mode 100644
index dd74cadd..0000000
--- a/packages/SystemUI/res/drawable/qs_background_primary.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<inset xmlns:android="http://schemas.android.com/apk/res/android">
- <shape>
- <solid android:color="@color/qs_background_dark"/>
- <corners android:radius="?android:attr/dialogCornerRadius" />
- </shape>
-</inset>
diff --git a/packages/SystemUI/res/drawable/qs_footer_drag_handle.xml b/packages/SystemUI/res/drawable/qs_footer_drag_handle.xml
index 509cd1f..59dad0e 100644
--- a/packages/SystemUI/res/drawable/qs_footer_drag_handle.xml
+++ b/packages/SystemUI/res/drawable/qs_footer_drag_handle.xml
@@ -17,6 +17,6 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid
- android:color="#e5e5e5" />
+ android:color="?android:attr/textColorPrimary" />
<corners android:radius="2dp" />
</shape>
diff --git a/packages/SystemUI/res/layout/feedback_info.xml b/packages/SystemUI/res/layout/feedback_info.xml
index 7047c1b..753f56a 100644
--- a/packages/SystemUI/res/layout/feedback_info.xml
+++ b/packages/SystemUI/res/layout/feedback_info.xml
@@ -109,24 +109,4 @@
style="@style/TextAppearance.NotificationInfo.Button"/>
</LinearLayout>
- <!-- Done button -->
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="@dimen/notification_guts_button_spacing"
- android:layout_marginBottom="@dimen/notification_guts_button_spacing"
- android:gravity="end"
- android:orientation="horizontal">
-
- <TextView
- android:id="@+id/ok"
- android:text="@string/feedback_ok"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:background="@drawable/ripple_drawable"
- android:minWidth="48dp"
- android:layout_marginStart="8dp"
- android:layout_marginEnd="-8dp"
- style="@style/TextAppearance.NotificationInfo.Button"/>
- </LinearLayout>
</com.android.systemui.statusbar.notification.row.FeedbackInfo>
diff --git a/packages/SystemUI/res/layout/people_space_activity.xml b/packages/SystemUI/res/layout/people_space_activity.xml
index 67ecdaa..07af01b 100644
--- a/packages/SystemUI/res/layout/people_space_activity.xml
+++ b/packages/SystemUI/res/layout/people_space_activity.xml
@@ -17,8 +17,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scroll"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="@android:color/holo_blue_light">
+ android:layout_height="match_parent">
<LinearLayout
android:id="@+id/people_space_layout"
@@ -30,16 +29,15 @@
android:clipChildren="false"
android:clipToPadding="false">
- <ImageView
- android:id="@+id/people_space_cloud"
- android:layout_width="67dp"
- android:layout_height="67dp"
+ <TextView
+ android:id="@+id/select_conversation"
+ android:text="@string/select_conversation_text"
+ android:layout_width="match_parent"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
+ android:textSize="24sp"
+ android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
- android:scaleType="fitCenter"
- android:focusable="false"
- android:paddingBottom="16dp"
- android:tint="?android:attr/colorControlNormal"
- android:src="@drawable/cloud" />
+ android:paddingBottom="16dp" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
\ No newline at end of file
diff --git a/packages/SystemUI/res/layout/people_space_large_avatar_tile.xml b/packages/SystemUI/res/layout/people_space_large_avatar_tile.xml
new file mode 100644
index 0000000..e9f3424
--- /dev/null
+++ b/packages/SystemUI/res/layout/people_space_large_avatar_tile.xml
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2020 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.
+ -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+ <LinearLayout
+ android:background="@drawable/people_space_round_tile_view_card"
+ android:id="@+id/item"
+ android:paddingVertical="6dp"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <LinearLayout
+ android:orientation="horizontal"
+ android:gravity="center_vertical"
+ android:paddingStart="12dp"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <ImageView
+ android:id="@+id/person_icon"
+ android:layout_width="60dp"
+ android:layout_height="60dp" />
+
+ <LinearLayout
+ android:background="@drawable/people_space_rounded_border"
+ android:layout_marginStart="-12dp"
+ android:layout_marginTop="28dp"
+ android:layout_marginBottom="14dp"
+ android:layout_width="16dp"
+ android:layout_height="16dp">
+
+ <ImageView
+ android:id="@+id/package_icon"
+ android:layout_width="12dp"
+ android:layout_marginStart="2dp"
+ android:layout_marginEnd="2dp"
+ android:layout_marginBottom="2dp"
+ android:layout_marginTop="2dp"
+ android:layout_height="12dp" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:orientation="vertical"
+ android:paddingStart="8dp"
+ android:paddingEnd="12dp"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <TextView
+ android:id="@+id/name"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
+ android:textColor="?android:attr/textColorPrimary"
+ android:textSize="16sp"
+ android:maxLines="1"
+ android:ellipsize="end"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
+
+ <TextView
+ android:id="@+id/status"
+ android:textColor="?android:attr/textColorSecondary"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
+ android:paddingVertical="3dp"
+ android:textSize="12sp"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:maxLines="3"
+ android:ellipsize="end" />
+ </LinearLayout>
+ </LinearLayout>
+ </LinearLayout>
+</LinearLayout>
\ No newline at end of file
diff --git a/packages/SystemUI/res/layout/people_space_small_avatar_tile.xml b/packages/SystemUI/res/layout/people_space_small_avatar_tile.xml
new file mode 100644
index 0000000..f474830
--- /dev/null
+++ b/packages/SystemUI/res/layout/people_space_small_avatar_tile.xml
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2020 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.
+ -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+ <LinearLayout
+ android:background="@drawable/people_space_tile_view_card"
+ android:id="@+id/item"
+ android:orientation="vertical"
+ android:paddingTop="6dp"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <LinearLayout
+ android:orientation="horizontal"
+ android:paddingHorizontal="12dp"
+ android:paddingBottom="4dp"
+ android:gravity="top"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <ImageView
+ android:id="@+id/person_icon"
+ android:layout_width="34dp"
+ android:layout_height="34dp" />
+
+ <LinearLayout
+ android:background="@drawable/people_space_rounded_border"
+ android:layout_marginStart="-5dp"
+ android:layout_marginTop="18dp"
+ android:layout_width="8dp"
+ android:layout_height="8dp">
+
+ <ImageView
+ android:id="@+id/package_icon"
+ android:layout_width="6dp"
+ android:layout_marginEnd="1dp"
+ android:layout_marginStart="1dp"
+ android:layout_marginBottom="1dp"
+ android:layout_marginTop="1dp"
+ android:layout_height="6dp" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:orientation="vertical"
+ android:paddingStart="6dp"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <TextView
+ android:id="@+id/name"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
+ android:textColor="?android:attr/textColorPrimary"
+ android:textSize="14sp"
+ android:maxLines="1"
+ android:ellipsize="end"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
+
+ <TextView
+ android:id="@+id/time"
+ android:textColor="?android:attr/textColorSecondary"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
+ android:textSize="10sp"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:maxLines="1"
+ android:ellipsize="end" />
+ </LinearLayout>
+ </LinearLayout>
+ <TextView
+ android:id="@+id/content"
+ android:paddingVertical="3dp"
+ android:paddingHorizontal="12dp"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
+ android:background="@drawable/people_space_content_background"
+ android:textSize="14sp"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:maxLines="2"
+ android:ellipsize="end" />
+ </LinearLayout>
+</LinearLayout>
\ No newline at end of file
diff --git a/packages/SystemUI/res/layout/people_space_tile_view.xml b/packages/SystemUI/res/layout/people_space_tile_view.xml
index 80bb070..c751e7d 100644
--- a/packages/SystemUI/res/layout/people_space_tile_view.xml
+++ b/packages/SystemUI/res/layout/people_space_tile_view.xml
@@ -20,46 +20,53 @@
android:orientation="vertical">
<LinearLayout
- android:background="@drawable/people_space_tile_view_card"
android:orientation="vertical"
- android:padding="16dp"
- android:layout_marginBottom="24dp"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
+ android:background="@drawable/people_space_activity_card"
+ android:padding="12dp"
android:elevation="4dp"
- android:gravity="start">
+ android:layout_marginBottom="12dp"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
- <ImageView
- android:id="@+id/tile_view_package_icon"
- android:layout_width="32dp"
- android:layout_height="32dp"
- android:layout_gravity="end" />
-
- <ImageView
- android:id="@+id/tile_view_person_icon"
- android:layout_width="32dp"
- android:layout_height="32dp"
- android:layout_gravity="start" />
-
- <TextView
- android:id="@+id/tile_view_name"
- android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
- android:paddingVertical="4dp"
- android:textSize="22sp"
- android:textColor="?android:attr/textColorPrimary"
- android:layout_width="wrap_content"
+ <LinearLayout
+ android:orientation="horizontal"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_gravity="start" />
+ android:gravity="start">
- <TextView
- android:id="@+id/tile_view_status"
- android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
- android:paddingVertical="4dp"
- android:textSize="16sp"
- android:textColor="?android:attr/textColorSecondary"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:ellipsize="end"
- android:layout_gravity="start" />
+ <ImageView
+ android:id="@+id/tile_view_person_icon"
+ android:layout_width="48dp"
+ android:layout_height="48dp" />
+
+ <ImageView
+ android:id="@+id/tile_view_package_icon"
+ android:layout_width="16dp"
+ android:layout_marginStart="-8dp"
+ android:layout_height="16dp" />
+
+ <LinearLayout
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <TextView
+ android:id="@+id/tile_view_name"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
+ android:paddingHorizontal="16dp"
+ android:textSize="22sp"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
+
+ <TextView
+ android:id="@+id/tile_view_status"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
+ android:paddingVertical="4dp"
+ android:textSize="12sp"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:ellipsize="end" />
+ </LinearLayout>
+ </LinearLayout>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
diff --git a/packages/SystemUI/res/layout/people_space_widget.xml b/packages/SystemUI/res/layout/people_space_widget.xml
index b417fcf..f4db321 100644
--- a/packages/SystemUI/res/layout/people_space_widget.xml
+++ b/packages/SystemUI/res/layout/people_space_widget.xml
@@ -22,6 +22,6 @@
android:background="@drawable/people_space_widget_background"
android:clipChildren="false"
android:clipToPadding="false"
- android:padding="5dp"
+ android:padding="2dp"
android:divider="@null"
android:dividerHeight="0dp"/>
\ No newline at end of file
diff --git a/packages/SystemUI/res/layout/people_space_widget_item.xml b/packages/SystemUI/res/layout/people_space_widget_item.xml
index e4de6f9..170386f 100644
--- a/packages/SystemUI/res/layout/people_space_widget_item.xml
+++ b/packages/SystemUI/res/layout/people_space_widget_item.xml
@@ -16,44 +16,77 @@
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
+ android:padding="4dp"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:background="@drawable/people_space_tile_view_card"
android:id="@+id/item"
android:orientation="vertical"
- android:padding="6dp"
- android:layout_marginBottom="6dp"
+ android:padding="4dp"
+ android:layout_marginBottom="2dp"
android:elevation="4dp"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="start">
- <ImageView
- android:id="@+id/package_icon"
- android:layout_width="30dp"
- android:layout_height="30dp"
- android:layout_gravity="end" />
- <ImageView
- android:id="@+id/person_icon"
- android:layout_width="30dp"
- android:layout_height="30dp"
- android:layout_gravity="start" />
- <TextView
- android:id="@+id/name"
- android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
- android:textSize="18sp"
- android:textColor="?android:attr/textColorPrimary"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="start" />
- <TextView
- android:id="@+id/status"
- android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
- android:paddingVertical="2dp"
- android:textSize="14sp"
- android:textColor="?android:attr/textColorSecondary"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="start" />
+ android:layout_height="wrap_content">
+
+ <LinearLayout
+ android:orientation="horizontal"
+ android:gravity="center_vertical"
+ android:paddingStart="12dp"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <ImageView
+ android:id="@+id/person_icon"
+ android:layout_width="60dp"
+ android:layout_height="60dp" />
+
+ <LinearLayout
+ android:background="@drawable/people_space_rounded_border"
+ android:layout_marginStart="-12dp"
+ android:layout_marginTop="28dp"
+ android:layout_marginBottom="14dp"
+ android:layout_width="16dp"
+ android:layout_height="16dp">
+
+ <ImageView
+ android:id="@+id/package_icon"
+ android:layout_width="12dp"
+ android:layout_marginStart="2dp"
+ android:layout_marginEnd="2dp"
+ android:layout_marginBottom="2dp"
+ android:layout_marginTop="2dp"
+ android:layout_height="12dp" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:orientation="vertical"
+ android:paddingStart="8dp"
+ android:paddingEnd="12dp"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <TextView
+ android:id="@+id/name"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
+ android:textColor="?android:attr/textColorPrimary"
+ android:textSize="16sp"
+ android:maxLines="1"
+ android:ellipsize="end"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
+
+ <TextView
+ android:id="@+id/status"
+ android:textColor="?android:attr/textColorSecondary"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
+ android:paddingVertical="2dp"
+ android:textSize="12sp"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:maxLines="3"
+ android:ellipsize="end" />
+ </LinearLayout>
+ </LinearLayout>
</LinearLayout>
</LinearLayout>
diff --git a/packages/SystemUI/res/layout/qs_panel.xml b/packages/SystemUI/res/layout/qs_panel.xml
index 89bf12d..387f2f2 100644
--- a/packages/SystemUI/res/layout/qs_panel.xml
+++ b/packages/SystemUI/res/layout/qs_panel.xml
@@ -25,9 +25,7 @@
<View
android:id="@+id/quick_settings_background"
android:layout_width="match_parent"
- android:layout_height="0dp"
- android:elevation="4dp"
- android:background="@drawable/qs_background_primary" />
+ android:layout_height="0dp" />
<com.android.systemui.qs.NonInterceptingScrollView
android:id="@+id/expanded_qs_scroll_view"
diff --git a/packages/SystemUI/res/layout/status_bar_expanded_plugin_frame.xml b/packages/SystemUI/res/layout/status_bar_expanded_plugin_frame.xml
index 69beffe..6f9d745 100644
--- a/packages/SystemUI/res/layout/status_bar_expanded_plugin_frame.xml
+++ b/packages/SystemUI/res/layout/status_bar_expanded_plugin_frame.xml
@@ -25,5 +25,4 @@
android:layout_marginTop="@dimen/notification_side_paddings"
android:layout_marginLeft="@dimen/notification_side_paddings"
android:layout_marginRight="@dimen/notification_side_paddings"
- android:visibility="gone"
- android:background="@drawable/qs_background_primary"/>
+ android:visibility="gone"/>
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 57e1d43..a960133 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -1194,8 +1194,8 @@
<dimen name="magnification_frame_move_long">25dp</dimen>
<dimen name="magnification_drag_view_size">38dp</dimen>
<dimen name="magnification_controls_size">90dp</dimen>
- <dimen name="magnification_switch_button_size">32dp</dimen>
- <dimen name="magnification_switch_button_padding">8dp</dimen>
+ <dimen name="magnification_switch_button_size">60dp</dimen>
+ <dimen name="magnification_switch_button_padding">12dp</dimen>
<dimen name="magnifier_left_right_controls_width">35dp</dimen>
<dimen name="magnifier_left_right_controls_height">45dp</dimen>
<dimen name="magnifier_up_down_controls_width">45dp</dimen>
@@ -1303,6 +1303,7 @@
<dimen name="media_output_dialog_icon_corner_radius">16dp</dimen>
<dimen name="media_output_dialog_title_anim_y_delta">12.5dp</dimen>
- <dimen name="people_space_widget_radius">10dp</dimen>
+ <dimen name="people_space_widget_radius">24dp</dimen>
+ <dimen name="people_space_widget_round_radius">100dp</dimen>
<dimen name="people_space_widget_background_padding">6dp</dimen>
</resources>
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 5b74687..7989b7a 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -2824,13 +2824,15 @@
<string name="build_number_copy_toast">Build number copied to clipboard.</string>
<!-- Status for last interaction with exact time [CHAR LIMIT=120] -->
- <string name="last_interaction_status" translatable="false">You last chatted <xliff:g id="duration" example="5 hours">%1$s</xliff:g> ago</string>
+ <string name="last_interaction_status" translatable="false">Last chatted <xliff:g id="duration" example="5 hours">%1$s</xliff:g> ago</string>
<!-- Status for last interaction when less than a certain time window [CHAR LIMIT=120] -->
- <string name="last_interaction_status_less_than" translatable="false">You last chatted less than <xliff:g id="duration" example="5 hours">%1$s</xliff:g> ago</string>
+ <string name="last_interaction_status_less_than" translatable="false">Last chatted less than <xliff:g id="duration" example="5 hours">%1$s</xliff:g> ago</string>
<!-- Status for last interaction when over a certain time window [CHAR LIMIT=120] -->
- <string name="last_interaction_status_over" translatable="false">You last chatted over <xliff:g id="duration" example="1 week">%1$s</xliff:g> ago</string>
+ <string name="last_interaction_status_over" translatable="false">Last chatted over <xliff:g id="duration" example="1 week">%1$s</xliff:g> ago</string>
<!-- Status for conversation without interaction data [CHAR LIMIT=120] -->
<string name="basic_status" translatable="false">Open conversation</string>
+ <!-- Status for conversation without interaction data [CHAR LIMIT=120] -->
+ <string name="select_conversation_text" translatable="false">Select one conversation to show in your widget:</string>
<!-- Title to display in a notification when ACTION_BATTERY_CHANGED.EXTRA_PRESENT field is false
[CHAR LIMIT=NONE] -->
diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml
index 0697c5c..6c0635a 100644
--- a/packages/SystemUI/res/values/styles.xml
+++ b/packages/SystemUI/res/values/styles.xml
@@ -489,7 +489,6 @@
<style name="TextAppearance.NotificationInfo">
<item name="android:fontFamily">@*android:string/config_headlineFontFamily</item>
- <item name="android:textColor">@color/notification_primary_text_color</item>
</style>
<style name="TextAppearance.NotificationInfo.Secondary">
@@ -498,7 +497,6 @@
</style>
<style name="TextAppearance.NotificationInfo.Title">
- <item name="android:textColor">@color/notification_primary_text_color</item>
<item name="android:textStyle">bold</item>
</style>
diff --git a/packages/SystemUI/res/xml/people_space_widget_info.xml b/packages/SystemUI/res/xml/people_space_widget_info.xml
index f08c8c8..10e28c4 100644
--- a/packages/SystemUI/res/xml/people_space_widget_info.xml
+++ b/packages/SystemUI/res/xml/people_space_widget_info.xml
@@ -15,10 +15,11 @@
-->
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
- android:minWidth="72dp"
- android:minHeight="150dp"
+ android:minWidth="180dp"
+ android:minHeight="40dp"
android:updatePeriodMillis="60000"
- android:previewImage="@drawable/cloud"
+ android:previewImage="@drawable/ic_android"
android:resizeMode="horizontal|vertical"
+ android:configure="com.android.systemui.people.PeopleSpaceActivity"
android:initialLayout="@layout/people_space_widget">
</appwidget-provider>
diff --git a/packages/SystemUI/src/com/android/systemui/accessibility/MagnificationModeSwitch.java b/packages/SystemUI/src/com/android/systemui/accessibility/MagnificationModeSwitch.java
index e40185c..267debc 100644
--- a/packages/SystemUI/src/com/android/systemui/accessibility/MagnificationModeSwitch.java
+++ b/packages/SystemUI/src/com/android/systemui/accessibility/MagnificationModeSwitch.java
@@ -23,6 +23,7 @@
import android.content.pm.ActivityInfo;
import android.graphics.PixelFormat;
import android.graphics.PointF;
+import android.graphics.Rect;
import android.os.Bundle;
import android.os.UserHandle;
import android.provider.Settings;
@@ -41,6 +42,8 @@
import com.android.internal.annotations.VisibleForTesting;
import com.android.systemui.R;
+import java.util.Collections;
+
/**
* Shows/hides a {@link android.widget.ImageView} on the screen and changes the values of
* {@link Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE} when the UI is toggled.
@@ -52,7 +55,7 @@
@VisibleForTesting
static final long FADING_ANIMATION_DURATION_MS = 300;
@VisibleForTesting
- static final int DEFAULT_FADE_OUT_ANIMATION_DELAY_MS = 3000;
+ static final int DEFAULT_FADE_OUT_ANIMATION_DELAY_MS = 5000;
private int mUiTimeout;
private final Runnable mFadeInAnimationTask;
private final Runnable mFadeOutAnimationTask;
@@ -85,7 +88,6 @@
mImageView = imageView;
mTouchSlop = ViewConfiguration.get(mContext).getScaledTouchSlop();
applyResourcesValues();
- mImageView.setImageResource(getIconResId(mMagnificationMode));
mImageView.setOnTouchListener(this::onTouch);
mImageView.setAccessibilityDelegate(new View.AccessibilityDelegate() {
@Override
@@ -138,6 +140,7 @@
final int padding = mContext.getResources().getDimensionPixelSize(
R.dimen.magnification_switch_button_padding);
mImageView.setPadding(padding, padding, padding, padding);
+ mImageView.setImageResource(getIconResId(mMagnificationMode));
}
private boolean onTouch(View v, MotionEvent event) {
@@ -205,6 +208,8 @@
}
if (!mIsVisible) {
mWindowManager.addView(mImageView, mParams);
+ // Exclude magnification switch button from system gesture area.
+ setSystemGestureExclusion();
mIsVisible = true;
mImageView.postOnAnimation(mFadeInAnimationTask);
mUiTimeout = mAccessibilityManager.getRecommendedTimeoutMillis(
@@ -224,7 +229,11 @@
void onConfigurationChanged(int configDiff) {
if ((configDiff & ActivityInfo.CONFIG_DENSITY) != 0) {
applyResourcesValues();
- mImageView.setImageResource(getIconResId(mMagnificationMode));
+ if (mIsVisible) {
+ mWindowManager.updateViewLayout(mImageView, mParams);
+ // Exclude magnification switch button from system gesture area.
+ setSystemGestureExclusion();
+ }
return;
}
if ((configDiff & ActivityInfo.CONFIG_LOCALE) != 0) {
@@ -261,7 +270,6 @@
ImageView imageView = new ImageView(context);
imageView.setClickable(true);
imageView.setFocusable(true);
- imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
imageView.setAlpha(0f);
return imageView;
}
@@ -288,4 +296,13 @@
private static String getAccessibilityWindowTitle(Context context) {
return context.getString(com.android.internal.R.string.android_system_label);
}
+
+ private void setSystemGestureExclusion() {
+ mImageView.post(() -> {
+ mImageView.setSystemGestureExclusionRects(
+ Collections.singletonList(
+ new Rect(0, 0, mImageView.getWidth(), mImageView.getHeight())));
+ });
+ }
+
}
diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java
index a330be6..ce5795c 100644
--- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java
@@ -103,7 +103,7 @@
d.setOnShowListener(dialog -> {
if (mBlurUtils.supportsBlursOnWindows()) {
- background.setAlpha((int) (ScrimController.BLUR_SCRIM_ALPHA * 255));
+ background.setAlpha((int) (ScrimController.BUSY_SCRIM_ALPHA * 255));
mBlurUtils.applyBlur(d.getWindow().getDecorView().getViewRootImpl(),
mBlurUtils.blurRadiusOfRatio(1));
} else {
diff --git a/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceActivity.java b/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceActivity.java
index 5cd3b33..4a633c3 100644
--- a/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceActivity.java
@@ -16,19 +16,30 @@
package com.android.systemui.people;
+import static android.appwidget.AppWidgetManager.EXTRA_APPWIDGET_ID;
+import static android.appwidget.AppWidgetManager.INVALID_APPWIDGET_ID;
+
import android.app.Activity;
import android.app.INotificationManager;
import android.app.people.IPeopleManager;
import android.app.people.PeopleSpaceTile;
+import android.appwidget.AppWidgetManager;
+import android.content.ComponentName;
import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
import android.content.pm.LauncherApps;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.os.ServiceManager;
+import android.provider.Settings;
import android.util.Log;
import android.view.ViewGroup;
+import androidx.preference.PreferenceManager;
+
import com.android.systemui.R;
+import com.android.systemui.people.widget.PeopleSpaceWidgetProvider;
import java.util.List;
import java.util.Map;
@@ -46,6 +57,9 @@
private PackageManager mPackageManager;
private LauncherApps mLauncherApps;
private Context mContext;
+ private AppWidgetManager mAppWidgetManager;
+ private int mAppWidgetId;
+ private boolean mShowSingleConversation;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -59,7 +73,18 @@
mPeopleManager = IPeopleManager.Stub.asInterface(
ServiceManager.getService(Context.PEOPLE_SERVICE));
mLauncherApps = mContext.getSystemService(LauncherApps.class);
+ mAppWidgetManager = AppWidgetManager.getInstance(mContext);
setTileViewsWithPriorityConversations();
+ mAppWidgetId = getIntent().getIntExtra(EXTRA_APPWIDGET_ID,
+ INVALID_APPWIDGET_ID);
+ mShowSingleConversation = Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.PEOPLE_SPACE_CONVERSATION_TYPE, 0) == 0;
+ // Finish the configuration activity immediately if a widget is added for multiple
+ // conversations. If the mAppWidgetId is INVALID, then the activity wasn't launched as a
+ // widget configuration activity.
+ if (!mShowSingleConversation && mAppWidgetId != INVALID_APPWIDGET_ID) {
+ finishActivity();
+ }
}
/**
@@ -93,12 +118,39 @@
tileView.setName(tile.getUserName().toString());
tileView.setPackageIcon(mPackageManager.getApplicationIcon(pkg));
tileView.setPersonIcon(tile.getUserIcon());
- tileView.setOnClickListener(mLauncherApps, tile);
+ tileView.setOnClickListener(v -> storeWidgetConfiguration(tile));
} catch (Exception e) {
Log.e(TAG, "Couldn't retrieve shortcut information", e);
}
}
+ /** Stores the user selected configuration for {@code mAppWidgetId}. */
+ private void storeWidgetConfiguration(PeopleSpaceTile tile) {
+ SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mContext);
+ SharedPreferences.Editor editor = sp.edit();
+ if (PeopleSpaceUtils.DEBUG) {
+ Log.d(TAG, "Put " + tile.getUserName() + "'s shortcut ID: "
+ + tile.getId() + " for widget ID: "
+ + mAppWidgetId);
+ }
+ editor.putString(String.valueOf(mAppWidgetId), tile.getId());
+ editor.commit();
+ AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(mContext);
+ int[] widgetIds = appWidgetManager.getAppWidgetIds(
+ new ComponentName(mContext, PeopleSpaceWidgetProvider.class));
+ PeopleSpaceUtils.updateSingleConversationWidgets(mContext, widgetIds, mAppWidgetManager,
+ mNotificationManager);
+ finishActivity();
+ }
+
+ /** Finish activity with a successful widget configuration result. */
+ private void finishActivity() {
+ Intent resultValue = new Intent();
+ resultValue.putExtra(EXTRA_APPWIDGET_ID, mAppWidgetId);
+ setResult(RESULT_OK, resultValue);
+ finish();
+ }
+
@Override
protected void onResume() {
super.onResume();
diff --git a/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceTileView.java b/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceTileView.java
index 4aea5b8..9ae7847 100644
--- a/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceTileView.java
+++ b/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceTileView.java
@@ -84,4 +84,9 @@
launcherApps.startShortcut(tile.getPackageName(), tile.getId(), null, null,
UserHandle.getUserHandleForUid(tile.getUid())));
}
+
+ /** Sets the click listener of the tile directly. */
+ public void setOnClickListener(OnClickListener onClickListener) {
+ mTileView.setOnClickListener(onClickListener);
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceUtils.java b/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceUtils.java
index fe262b4..dddd39b 100644
--- a/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceUtils.java
+++ b/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceUtils.java
@@ -17,11 +17,17 @@
package com.android.systemui.people;
import android.app.INotificationManager;
+import android.app.PendingIntent;
import android.app.people.ConversationChannel;
import android.app.people.IPeopleManager;
import android.app.people.PeopleSpaceTile;
+import android.appwidget.AppWidgetHost;
+import android.appwidget.AppWidgetManager;
import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
import android.content.pm.LauncherApps;
+import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.drawable.BitmapDrawable;
@@ -29,17 +35,24 @@
import android.icu.text.MeasureFormat;
import android.icu.util.Measure;
import android.icu.util.MeasureUnit;
+import android.os.ServiceManager;
import android.os.UserHandle;
import android.provider.Settings;
import android.service.notification.ConversationChannelWrapper;
import android.util.Log;
+import android.widget.RemoteViews;
+
+import androidx.preference.PreferenceManager;
import com.android.systemui.R;
+import com.android.systemui.people.widget.LaunchConversationActivity;
+import com.android.systemui.people.widget.PeopleSpaceWidgetProvider;
import java.time.Duration;
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -57,14 +70,15 @@
Context context, INotificationManager notificationManager, IPeopleManager peopleManager,
LauncherApps launcherApps)
throws Exception {
- boolean showAllConversations = Settings.Global.getInt(context.getContentResolver(),
- Settings.Global.PEOPLE_SPACE_CONVERSATION_TYPE, 0) == 0;
+ boolean showOnlyPriority = Settings.Global.getInt(context.getContentResolver(),
+ Settings.Global.PEOPLE_SPACE_CONVERSATION_TYPE, 0) == 1;
List<ConversationChannelWrapper> conversations = notificationManager.getConversations(
true).getList();
List<Map.Entry<Long, PeopleSpaceTile>> tiles = getSortedTiles(peopleManager,
conversations.stream().map(c ->
new PeopleSpaceTile.Builder(c.getShortcutInfo(), launcherApps).build()));
- if (showAllConversations) {
+ if (!showOnlyPriority) {
+ if (DEBUG) Log.d(TAG, "Add recent conversations");
List<ConversationChannel> recentConversations =
peopleManager.getRecentConversations().getList();
List<Map.Entry<Long, PeopleSpaceTile>> recentTiles =
@@ -77,6 +91,79 @@
return tiles;
}
+ /** Updates {@code appWidgetIds} with their associated conversation stored. */
+ public static void updateSingleConversationWidgets(Context context, int[] appWidgetIds,
+ AppWidgetManager appWidgetManager, INotificationManager notificationManager) {
+ PackageManager mPackageManager = context.getPackageManager();
+ IPeopleManager mPeopleManager = IPeopleManager.Stub.asInterface(
+ ServiceManager.getService(Context.PEOPLE_SERVICE));
+ LauncherApps mLauncherApps = context.getSystemService(LauncherApps.class);
+ SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
+ Intent activityIntent = new Intent(context, LaunchConversationActivity.class);
+ activityIntent.addFlags(
+ Intent.FLAG_ACTIVITY_NEW_TASK
+ | Intent.FLAG_ACTIVITY_CLEAR_TASK
+ | Intent.FLAG_ACTIVITY_NO_HISTORY
+ | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
+ try {
+ List<Map.Entry<Long, PeopleSpaceTile>> shortcutInfos =
+ PeopleSpaceUtils.getTiles(
+ context, notificationManager,
+ mPeopleManager, mLauncherApps);
+ for (int appWidgetId : appWidgetIds) {
+ String shortcutId = sp.getString(String.valueOf(appWidgetId), null);
+ if (DEBUG) {
+ Log.d(TAG, "Set widget: " + appWidgetId + " with shortcut ID: " + shortcutId);
+ }
+
+ Optional<Map.Entry<Long, PeopleSpaceTile>> entry = shortcutInfos.stream().filter(
+ e -> e.getValue().getId().equals(shortcutId)).findFirst();
+ if (!entry.isPresent() || shortcutId == null) {
+ if (DEBUG) Log.d(TAG, "Matching conversation not found for shortcut ID");
+ AppWidgetHost host = new AppWidgetHost(context, 0);
+ host.deleteAppWidgetId(appWidgetId);
+ continue;
+ }
+ PeopleSpaceTile tile = entry.get().getValue();
+ RemoteViews views = new RemoteViews(context.getPackageName(),
+ getLayout(tile));
+
+ String status = PeopleSpaceUtils.getLastInteractionString(context,
+ entry.get().getKey());
+ views.setTextViewText(R.id.status, status);
+ views.setTextViewText(R.id.name, tile.getUserName().toString());
+
+ activityIntent.putExtra(PeopleSpaceWidgetProvider.EXTRA_TILE_ID, tile.getId());
+ activityIntent.putExtra(
+ PeopleSpaceWidgetProvider.EXTRA_PACKAGE_NAME, tile.getPackageName());
+ activityIntent.putExtra(PeopleSpaceWidgetProvider.EXTRA_UID, tile.getUid());
+ views.setOnClickPendingIntent(R.id.item, PendingIntent.getActivity(
+ context,
+ appWidgetId,
+ activityIntent,
+ PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE));
+
+ views.setImageViewBitmap(
+ R.id.package_icon,
+ PeopleSpaceUtils.convertDrawableToBitmap(
+ mPackageManager.getApplicationIcon(tile.getPackageName())
+ )
+ );
+ views.setImageViewIcon(R.id.person_icon, tile.getUserIcon());
+ // Tell the AppWidgetManager to perform an update on the current app widget.
+ appWidgetManager.updateAppWidget(appWidgetId, views);
+ }
+ } catch (Exception e) {
+ Log.e(TAG, "Failed to retrieve conversations to set tiles");
+ }
+ }
+
+ /** Returns the layout ID for the {@code tile}. */
+ private static int getLayout(PeopleSpaceTile tile) {
+ return tile.getNotification() == null ? R.layout.people_space_large_avatar_tile :
+ R.layout.people_space_small_avatar_tile;
+ }
+
/** Returns a list sorted by ascending last interaction time from {@code stream}. */
private static List<Map.Entry<Long, PeopleSpaceTile>> getSortedTiles(
IPeopleManager peopleManager, Stream<PeopleSpaceTile> stream) {
diff --git a/packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetManager.java b/packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetManager.java
index 9b7cf6e..ac32e19 100644
--- a/packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetManager.java
+++ b/packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetManager.java
@@ -16,11 +16,14 @@
package com.android.systemui.people.widget;
+import android.app.INotificationManager;
import android.app.NotificationChannel;
+import android.appwidget.AppWidgetManager;
import android.content.ComponentName;
import android.content.Context;
import android.os.ServiceManager;
import android.os.UserHandle;
+import android.provider.Settings;
import android.service.notification.NotificationListenerService;
import android.service.notification.StatusBarNotification;
import android.util.Log;
@@ -42,13 +45,18 @@
private static final boolean DEBUG = PeopleSpaceUtils.DEBUG;
private final Context mContext;
- private IAppWidgetService mAppWidgetManager;
+ private IAppWidgetService mAppWidgetService;
+ private AppWidgetManager mAppWidgetManager;
+ private INotificationManager mNotificationManager;
@Inject
public PeopleSpaceWidgetManager(Context context, IAppWidgetService appWidgetService) {
if (DEBUG) Log.d(TAG, "constructor");
mContext = context;
- mAppWidgetManager = appWidgetService;
+ mAppWidgetService = appWidgetService;
+ mAppWidgetManager = AppWidgetManager.getInstance(context);
+ mNotificationManager = INotificationManager.Stub.asInterface(
+ ServiceManager.getService(Context.NOTIFICATION_SERVICE));
}
/** Constructor used for testing. */
@@ -56,21 +64,24 @@
protected PeopleSpaceWidgetManager(Context context) {
if (DEBUG) Log.d(TAG, "constructor");
mContext = context;
- mAppWidgetManager = IAppWidgetService.Stub.asInterface(
+ mAppWidgetService = IAppWidgetService.Stub.asInterface(
ServiceManager.getService(Context.APPWIDGET_SERVICE));
}
/** AppWidgetManager setter used for testing. */
@VisibleForTesting
- protected void setAppWidgetManager(IAppWidgetService appWidgetService) {
- mAppWidgetManager = appWidgetService;
+ protected void setAppWidgetManager(IAppWidgetService appWidgetService,
+ AppWidgetManager appWidgetManager, INotificationManager notificationManager) {
+ mAppWidgetService = appWidgetService;
+ mAppWidgetManager = appWidgetManager;
+ mNotificationManager = notificationManager;
}
/** Updates People Space widgets. */
public void updateWidgets() {
try {
if (DEBUG) Log.d(TAG, "updateWidgets called");
- int[] widgetIds = mAppWidgetManager.getAppWidgetIds(
+ int[] widgetIds = mAppWidgetService.getAppWidgetIds(
new ComponentName(mContext, PeopleSpaceWidgetProvider.class)
);
@@ -80,9 +91,16 @@
}
if (DEBUG) Log.d(TAG, "updating " + widgetIds.length + " widgets");
- mAppWidgetManager
- .notifyAppWidgetViewDataChanged(mContext.getOpPackageName(), widgetIds,
- R.id.widget_list_view);
+ boolean showSingleConversation = Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.PEOPLE_SPACE_CONVERSATION_TYPE, 0) == 0;
+ if (showSingleConversation) {
+ PeopleSpaceUtils.updateSingleConversationWidgets(mContext, widgetIds,
+ mAppWidgetManager, mNotificationManager);
+ } else {
+ mAppWidgetService
+ .notifyAppWidgetViewDataChanged(mContext.getOpPackageName(), widgetIds,
+ R.id.widget_list_view);
+ }
} catch (Exception e) {
Log.e(TAG, "Exception: " + e);
}
@@ -125,7 +143,8 @@
@Override
public void onNotificationRankingUpdate(
- NotificationListenerService.RankingMap rankingMap) { }
+ NotificationListenerService.RankingMap rankingMap) {
+ }
@Override
public void onNotificationsInitialized() {
diff --git a/packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetProvider.java b/packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetProvider.java
index 9f84514..1ee9e0e 100644
--- a/packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetProvider.java
+++ b/packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetProvider.java
@@ -16,11 +16,14 @@
package com.android.systemui.people.widget;
+import android.app.INotificationManager;
import android.app.PendingIntent;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.Context;
import android.content.Intent;
+import android.os.ServiceManager;
+import android.provider.Settings;
import android.util.Log;
import android.widget.RemoteViews;
@@ -41,6 +44,14 @@
super.onUpdate(context, appWidgetManager, appWidgetIds);
if (DEBUG) Log.d(TAG, "onUpdate called");
+ boolean showSingleConversation = Settings.Global.getInt(context.getContentResolver(),
+ Settings.Global.PEOPLE_SPACE_CONVERSATION_TYPE, 0) == 0;
+ if (showSingleConversation) {
+ PeopleSpaceUtils.updateSingleConversationWidgets(context, appWidgetIds,
+ appWidgetManager, INotificationManager.Stub.asInterface(
+ ServiceManager.getService(Context.NOTIFICATION_SERVICE)));
+ return;
+ }
// Perform this loop procedure for each App Widget that belongs to this provider
for (int appWidgetId : appWidgetIds) {
RemoteViews views =
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSSecurityFooter.java b/packages/SystemUI/src/com/android/systemui/qs/QSSecurityFooter.java
index 5afe526..3866382 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSSecurityFooter.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSSecurityFooter.java
@@ -143,8 +143,6 @@
}
public void showDeviceMonitoringDialog() {
- mHost.collapsePanels();
- // TODO: Delay dialog creation until after panels are collapsed.
createDialog();
}
@@ -291,6 +289,7 @@
if (which == DialogInterface.BUTTON_NEGATIVE) {
final Intent intent = new Intent(Settings.ACTION_ENTERPRISE_PRIVACY_SETTINGS);
mDialog.dismiss();
+ // This dismisses the shade on opening the activity
mActivityStarter.postStartActivityDismissingKeyguard(intent, 0);
}
}
@@ -605,6 +604,7 @@
public void onClick(View widget) {
final Intent intent = new Intent(Settings.ACTION_VPN_SETTINGS);
mDialog.dismiss();
+ // This dismisses the shade on opening the activity
mActivityStarter.postStartActivityDismissingKeyguard(intent, 0);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/FeedbackInfo.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/FeedbackInfo.java
index 4c78e62..149ee8c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/FeedbackInfo.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/FeedbackInfo.java
@@ -19,7 +19,6 @@
import static android.app.NotificationManager.IMPORTANCE_DEFAULT;
import static android.service.notification.NotificationListenerService.Ranking.RANKING_DEMOTED;
import static android.service.notification.NotificationListenerService.Ranking.RANKING_PROMOTED;
-import static android.service.notification.NotificationListenerService.Ranking.RANKING_UNCHANGED;
import android.annotation.SuppressLint;
import android.app.Notification;
@@ -43,6 +42,7 @@
import com.android.internal.statusbar.NotificationVisibility;
import com.android.systemui.Dependency;
import com.android.systemui.R;
+import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;
import com.android.systemui.statusbar.notification.AssistantFeedbackController;
import com.android.systemui.statusbar.notification.NotificationEntryManager;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
@@ -64,6 +64,9 @@
private NotificationEntryManager mNotificationEntryManager;
private IStatusBarService mStatusBarService;
private AssistantFeedbackController mFeedbackController;
+ private NotificationGutsManager mNotificationGutsManager;
+ private NotificationMenuRowPlugin mMenuRowPlugin;
+ private ExpandableNotificationRow mExpandableNotificationRow;
public FeedbackInfo(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -73,19 +76,21 @@
final PackageManager pm,
final StatusBarNotification sbn,
final NotificationEntry entry,
+ final ExpandableNotificationRow row,
final AssistantFeedbackController controller) {
mPkg = sbn.getPackageName();
mPm = pm;
mEntry = entry;
+ mExpandableNotificationRow = row;
mRanking = entry.getRanking();
mFeedbackController = controller;
mAppName = mPkg;
mNotificationEntryManager = Dependency.get(NotificationEntryManager.class);
mStatusBarService = Dependency.get(IStatusBarService.class);
+ mNotificationGutsManager = Dependency.get(NotificationGutsManager.class);
bindHeader();
bindPrompt();
- bindButton();
}
private void bindHeader() {
@@ -161,27 +166,24 @@
return sb.toString();
}
- private void bindButton() {
- TextView ok = findViewById(R.id.ok);
- ok.setOnClickListener(this::closeControls);
- }
-
private void positiveFeedback(View v) {
+ mGutsContainer.closeControls(v, false);
handleFeedback(true);
}
private void negativeFeedback(View v) {
+ mMenuRowPlugin = mExpandableNotificationRow.getProvider();
+ NotificationMenuRowPlugin.MenuItem menuItem = null;
+ if (mMenuRowPlugin != null) {
+ menuItem = mMenuRowPlugin.getLongpressMenuItem(mContext);
+ }
+
+ mGutsContainer.closeControls(v, false);
+ mNotificationGutsManager.openGuts(mExpandableNotificationRow, 0, 0, menuItem);
handleFeedback(false);
}
private void handleFeedback(boolean positive) {
- TextView prompt = findViewById(R.id.prompt);
- prompt.setText(mContext.getString(R.string.feedback_response));
- TextView yes = findViewById(R.id.yes);
- yes.setVisibility(View.GONE);
- TextView no = findViewById(R.id.no);
- no.setVisibility(View.GONE);
-
Bundle feedback = new Bundle();
feedback.putBoolean(FEEDBACK_KEY, positive);
sendFeedbackToAssistant(feedback);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java
index d2cfb29..c4f0098 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java
@@ -324,7 +324,7 @@
userHandle.getIdentifier());
if (mAssistantFeedbackController.showFeedbackIndicator(row.getEntry())) {
- feedbackInfo.bindGuts(pmUser, sbn, row.getEntry(), mAssistantFeedbackController);
+ feedbackInfo.bindGuts(pmUser, sbn, row.getEntry(), row, mAssistantFeedbackController);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationCustomViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationCustomViewWrapper.java
index 4c9c2f9..414d620 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationCustomViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationCustomViewWrapper.java
@@ -47,6 +47,10 @@
public void onContentUpdated(ExpandableNotificationRow row) {
super.onContentUpdated(row);
+ // Custom views will most likely use just white or black as their text color.
+ // We need to scan through and replace these colors by Material NEXT colors.
+ ensureThemeOnChildren();
+
// Let's invert the notification colors when we're in night mode and
// the notification background isn't colorized.
if (needsInversion(mBackgroundColor, mView)) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationDecoratedCustomViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationDecoratedCustomViewWrapper.java
index 49a8d56..7964845 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationDecoratedCustomViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationDecoratedCustomViewWrapper.java
@@ -43,6 +43,11 @@
if (childIndex != null && childIndex != -1) {
mWrappedView = container.getChildAt(childIndex);
}
+
+ // Custom views will most likely use just white or black as their text color.
+ // We need to scan through and replace these colors by Material NEXT colors.
+ ensureThemeOnChildren();
+
if (needsInversion(resolveBackgroundColor(), mWrappedView)) {
invertViewLuminosity(mWrappedView);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationViewWrapper.java
index 416c5af..2d706a4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationViewWrapper.java
@@ -29,11 +29,13 @@
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
+import android.view.ContextThemeWrapper;
import android.view.NotificationHeaderView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
+import com.android.internal.R;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.graphics.ColorUtils;
import com.android.internal.util.ContrastColorUtil;
@@ -55,6 +57,9 @@
private final Rect mTmpRect = new Rect();
protected int mBackgroundColor = 0;
+ private int mLightTextColor;
+ private int mDarkTextColor;
+ private int mDefaultTextColor;
public static NotificationViewWrapper wrap(Context ctx, View v, ExpandableNotificationRow row) {
if (v.getId() == com.android.internal.R.id.status_bar_latest_event_content) {
@@ -110,6 +115,15 @@
mBackgroundColor = backgroundColor;
mView.setBackground(new ColorDrawable(Color.TRANSPARENT));
}
+ mLightTextColor = mView.getContext().getColor(
+ com.android.internal.R.color.notification_primary_text_color_light);
+ mDarkTextColor = mView.getContext().getColor(
+ R.color.notification_primary_text_color_dark);
+
+ Context themedContext = new ContextThemeWrapper(mView.getContext(),
+ R.style.Theme_DeviceDefault_DayNight);
+ mDefaultTextColor = Utils.getColorAttr(themedContext, R.attr.textColorPrimary)
+ .getDefaultColor();
}
protected boolean needsInversion(int defaultBackgroundColor, View view) {
@@ -187,6 +201,42 @@
return false;
}
+ protected void ensureThemeOnChildren() {
+ if (mView == null) {
+ return;
+ }
+
+ // Notifications with custom backgrounds should not be adjusted
+ if (mBackgroundColor != Color.TRANSPARENT
+ || getBackgroundColor(mView) != Color.TRANSPARENT) {
+ return;
+ }
+
+ // Now let's check if there's unprotected text somewhere, and apply the theme if we find it.
+ if (!(mView instanceof ViewGroup)) {
+ return;
+ }
+ processChildrenTextColor((ViewGroup) mView);
+ }
+
+ private void processChildrenTextColor(ViewGroup viewGroup) {
+ if (viewGroup == null) {
+ return;
+ }
+
+ for (int i = 0; i < viewGroup.getChildCount(); i++) {
+ View child = viewGroup.getChildAt(i);
+ if (child instanceof TextView) {
+ int foreground = ((TextView) child).getCurrentTextColor();
+ if (foreground == mLightTextColor || foreground == mDarkTextColor) {
+ ((TextView) child).setTextColor(mDefaultTextColor);
+ }
+ } else if (child instanceof ViewGroup) {
+ processChildrenTextColor((ViewGroup) child);
+ }
+ }
+ }
+
protected int getBackgroundColor(View view) {
if (view == null) {
return Color.TRANSPARENT;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java
index 1a2d1cf..b9e8d74 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java
@@ -116,6 +116,11 @@
*/
private float mDarkAmount;
+ /**
+ * How visible the quick settings panel is.
+ */
+ private float mQsExpansion;
+
private float mEmptyDragAmount;
/**
@@ -159,7 +164,8 @@
public void setup(int statusBarMinHeight, int maxShadeBottom, int notificationStackHeight,
float panelExpansion, int parentHeight, int keyguardStatusHeight, int clockPreferredY,
boolean hasCustomClock, boolean hasVisibleNotifs, float dark, float emptyDragAmount,
- boolean bypassEnabled, int unlockedStackScrollerPadding, boolean udfpsEnrolled) {
+ boolean bypassEnabled, int unlockedStackScrollerPadding, boolean udfpsEnrolled,
+ float qsExpansion) {
mMinTopMargin = statusBarMinHeight + (udfpsEnrolled ? mContainerTopPaddingWithoutLockIcon :
mContainerTopPaddingWithLockIcon);
mMaxShadeBottom = maxShadeBottom;
@@ -174,6 +180,7 @@
mEmptyDragAmount = emptyDragAmount;
mBypassEnabled = bypassEnabled;
mUnlockedStackScrollerPadding = unlockedStackScrollerPadding;
+ mQsExpansion = qsExpansion;
}
public void run(Result result) {
@@ -274,6 +281,7 @@
*/
private float getClockAlpha(int y) {
float alphaKeyguard = Math.max(0, y / Math.max(1f, getClockY(1f)));
+ alphaKeyguard *= (1f - mQsExpansion);
alphaKeyguard = Interpolators.ACCELERATE.getInterpolation(alphaKeyguard);
return MathUtils.lerp(alphaKeyguard, 1f, mDarkAmount);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
index 84eacdc..01a7292 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
@@ -292,6 +292,7 @@
private final StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
private final KeyguardStatusViewComponent.Factory mKeyguardStatusViewComponentFactory;
private final QSDetailDisplayer mQSDetailDisplayer;
+ private final ScrimController mScrimController;
// Maximum # notifications to show on Keyguard; extras will be collapsed in an overflow card.
// If there are exactly 1 + mMaxKeyguardNotifications, then still shows all notifications
private final int mMaxKeyguardNotifications;
@@ -549,6 +550,7 @@
NotificationIconAreaController notificationIconAreaController,
AuthController authController,
QSDetailDisplayer qsDetailDisplayer,
+ ScrimController scrimController,
MediaDataManager mediaDataManager) {
super(view, falsingManager, dozeLog, keyguardStateController,
(SysuiStatusBarStateController) statusBarStateController, vibratorHelper,
@@ -579,6 +581,7 @@
mPulseExpansionHandler = pulseExpansionHandler;
mDozeParameters = dozeParameters;
mBiometricUnlockController = biometricUnlockController;
+ mScrimController = scrimController;
mMediaDataManager = mediaDataManager;
pulseExpansionHandler.setPulseExpandAbortListener(() -> {
if (mQs != null) {
@@ -909,7 +912,7 @@
clockPreferredY, hasCustomClock(),
hasVisibleNotifications, mInterpolatedDarkAmount, mEmptyDragAmount,
bypassEnabled, getUnlockedStackScrollerPadding(),
- mUpdateMonitor.isUdfpsEnrolled());
+ mUpdateMonitor.isUdfpsEnrolled(), getQsExpansionFraction());
mClockPositionAlgorithm.run(mClockPositionResult);
mKeyguardStatusViewController.updatePosition(
mClockPositionResult.clockX, mClockPositionResult.clockY,
@@ -1756,6 +1759,7 @@
updateHeaderKeyguardAlpha();
if (mBarState == StatusBarState.SHADE_LOCKED || mBarState == KEYGUARD) {
updateKeyguardBottomAreaAlpha();
+ positionClockAndNotifications();
updateBigClockAlpha();
}
@@ -1782,6 +1786,7 @@
float qsExpansionFraction = getQsExpansionFraction();
mQs.setQsExpansion(qsExpansionFraction, getHeaderTranslation());
mMediaHierarchyManager.setQsExpansion(qsExpansionFraction);
+ mScrimController.setQsExpansion(qsExpansionFraction);
mNotificationStackScrollLayoutController.setQsExpansionFraction(qsExpansionFraction);
}
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 9e7efc1..f8e361f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
@@ -125,11 +125,6 @@
*/
public static final float BUSY_SCRIM_ALPHA = 1f;
- /**
- * Same as above, but when blur is supported.
- */
- public static final float BLUR_SCRIM_ALPHA = 0.80f;
-
static final int TAG_KEY_ANIM = R.id.scrim;
private static final int TAG_START_ALPHA = R.id.scrim_alpha_start;
private static final int TAG_END_ALPHA = R.id.scrim_alpha_end;
@@ -161,6 +156,7 @@
// Assuming the shade is expanded during initialization
private float mExpansionFraction = 1f;
+ private float mQsExpansion;
private boolean mDarkenWhileDragging;
private boolean mExpansionAffectsAlpha = true;
@@ -206,8 +202,7 @@
BlurUtils blurUtils, ConfigurationController configurationController) {
mScrimStateListener = lightBarController::setScrimState;
- mDefaultScrimAlpha = blurUtils.supportsBlursOnWindows()
- ? BLUR_SCRIM_ALPHA : BUSY_SCRIM_ALPHA;
+ mDefaultScrimAlpha = BUSY_SCRIM_ALPHA;
mBlurUtils = blurUtils;
mKeyguardStateController = keyguardStateController;
@@ -464,6 +459,31 @@
boolean relevantState = (mState == ScrimState.UNLOCKED
|| mState == ScrimState.KEYGUARD
+ || mState == ScrimState.SHADE_LOCKED
+ || mState == ScrimState.PULSING
+ || mState == ScrimState.BUBBLE_EXPANDED);
+ if (!(relevantState && mExpansionAffectsAlpha)) {
+ return;
+ }
+ applyAndDispatchExpansion();
+ }
+ }
+
+ /**
+ * Current state of the QuickSettings expansion when pulling it from the top.
+ *
+ * @param fraction From 0 to 1 where 0 means collapsed and 1 expanded.
+ */
+ public void setQsExpansion(float fraction) {
+ if (isNaN(fraction)) {
+ return;
+ }
+ if (mQsExpansion != fraction) {
+ mQsExpansion = fraction;
+ Log.d(TAG, "set qs fraction");
+
+ boolean relevantState = (mState == ScrimState.SHADE_LOCKED
+ || mState == ScrimState.KEYGUARD
|| mState == ScrimState.PULSING
|| mState == ScrimState.BUBBLE_EXPANDED);
if (!(relevantState && mExpansionAffectsAlpha)) {
@@ -506,7 +526,8 @@
behindFraction = (float) Math.pow(behindFraction, 0.8f);
mBehindAlpha = behindFraction * mDefaultScrimAlpha;
mInFrontAlpha = 0;
- } else if (mState == ScrimState.KEYGUARD || mState == ScrimState.PULSING) {
+ } else if (mState == ScrimState.KEYGUARD || mState == ScrimState.SHADE_LOCKED
+ || mState == ScrimState.PULSING) {
// Either darken of make the scrim transparent when you
// pull down the shade
float interpolatedFract = getInterpolatedFraction();
@@ -522,6 +543,11 @@
}
mBehindTint = ColorUtils.blendARGB(ScrimState.BOUNCER.getBehindTint(),
mState.getBehindTint(), interpolatedFract);
+ if (mQsExpansion > 0) {
+ mBehindAlpha = MathUtils.lerp(mBehindAlpha, mDefaultScrimAlpha, mQsExpansion);
+ mBehindTint = ColorUtils.blendARGB(mBehindTint,
+ ScrimState.SHADE_LOCKED.getBehindTint(), mQsExpansion);
+ }
}
if (isNaN(mBehindAlpha) || isNaN(mInFrontAlpha)) {
throw new IllegalStateException("Scrim opacity is NaN for state: " + mState
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 fc91c16..994da79 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java
@@ -112,6 +112,15 @@
}
},
+ SHADE_LOCKED {
+ @Override
+ public void prepare(ScrimState previousState) {
+ mBehindAlpha = mDefaultScrimAlpha;
+ mBubbleAlpha = 0f;
+ mFrontAlpha = 0f;
+ }
+ },
+
/**
* Changing screen brightness from quick settings.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
index 981f9a6..9ebde53 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -4099,6 +4099,8 @@
mScrimController.transitionTo(ScrimState.UNLOCKED, mUnlockScrimCallback);
} else if (mBrightnessMirrorVisible) {
mScrimController.transitionTo(ScrimState.BRIGHTNESS_MIRROR);
+ } else if (mState == StatusBarState.SHADE_LOCKED) {
+ mScrimController.transitionTo(ScrimState.SHADE_LOCKED);
} else if (mDozeServiceHost.isPulsing()) {
mScrimController.transitionTo(ScrimState.PULSING,
mDozeScrimController.getScrimCallback());
diff --git a/packages/SystemUI/src/com/android/systemui/wmshell/WMShell.java b/packages/SystemUI/src/com/android/systemui/wmshell/WMShell.java
index a879a1e..2a18f3c5 100644
--- a/packages/SystemUI/src/com/android/systemui/wmshell/WMShell.java
+++ b/packages/SystemUI/src/com/android/systemui/wmshell/WMShell.java
@@ -168,6 +168,11 @@
mConfigurationController.addCallback(new ConfigurationController.ConfigurationListener() {
@Override
+ public void onConfigChanged(Configuration newConfig) {
+ pip.onConfigurationChanged(newConfig);
+ }
+
+ @Override
public void onDensityOrFontScaleChanged() {
pip.onDensityOrFontScaleChanged();
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/accessibility/MagnificationModeSwitchTest.java b/packages/SystemUI/tests/src/com/android/systemui/accessibility/MagnificationModeSwitchTest.java
index 1115043..0451d45 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/accessibility/MagnificationModeSwitchTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/accessibility/MagnificationModeSwitchTest.java
@@ -143,6 +143,13 @@
}
@Test
+ public void showButton_excludeSystemGestureArea() {
+ mMagnificationModeSwitch.showButton(ACCESSIBILITY_MAGNIFICATION_MODE_WINDOW);
+
+ verify(mSpyImageView).setSystemGestureExclusionRects(any(List.class));
+ }
+
+ @Test
public void showMagnificationButton_setA11yTimeout_postDelayedAnimationWithA11yTimeout() {
final int a11yTimeout = 12345;
when(mAccessibilityManager.getRecommendedTimeoutMillis(anyInt(), anyInt())).thenReturn(
@@ -178,14 +185,17 @@
}
@Test
- public void onConfigurationChanged_buttonIsShowing_setImageResource() {
+ public void onConfigurationChanged_buttonIsShowing_updateResourcesAndLayout() {
mMagnificationModeSwitch.showButton(ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN);
resetAndStubMockImageViewAndAnimator();
mMagnificationModeSwitch.onConfigurationChanged(ActivityInfo.CONFIG_DENSITY);
+ verify(mSpyImageView).setPadding(anyInt(), anyInt(), anyInt(), anyInt());
verify(mSpyImageView).setImageResource(
getIconResId(ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN));
+ verify(mWindowManager).updateViewLayout(eq(mSpyImageView), any());
+ verify(mSpyImageView).setSystemGestureExclusionRects(any(List.class));
}
@Test
@@ -368,6 +378,11 @@
private void resetAndStubMockImageViewAndAnimator() {
resetAndStubMockAnimator();
Mockito.reset(mSpyImageView);
+ doAnswer(invocation -> {
+ final Runnable runnable = invocation.getArgument(0);
+ runnable.run();
+ return null;
+ }).when(mSpyImageView).post(any(Runnable.class));
doReturn(mViewPropertyAnimator).when(mSpyImageView).animate();
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/people/widget/PeopleSpaceWidgetManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/people/widget/PeopleSpaceWidgetManagerTest.java
index 477fe63..019424c 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/people/widget/PeopleSpaceWidgetManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/people/widget/PeopleSpaceWidgetManagerTest.java
@@ -29,12 +29,20 @@
import static java.util.Objects.requireNonNull;
+import android.app.INotificationManager;
import android.app.NotificationChannel;
-import android.content.Context;
+import android.appwidget.AppWidgetManager;
+import android.content.SharedPreferences;
+import android.content.pm.ParceledListSlice;
+import android.content.pm.ShortcutInfo;
import android.os.RemoteException;
import android.os.UserHandle;
+import android.provider.Settings;
+import android.service.notification.ConversationChannelWrapper;
import android.testing.AndroidTestingRunner;
+import android.widget.RemoteViews;
+import androidx.preference.PreferenceManager;
import androidx.test.filters.SmallTest;
import com.android.internal.appwidget.IAppWidgetService;
@@ -54,6 +62,9 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
+import java.util.ArrayList;
+import java.util.List;
+
@SmallTest
@RunWith(AndroidTestingRunner.class)
public class PeopleSpaceWidgetManagerTest extends SysuiTestCase {
@@ -65,14 +76,23 @@
private static final String TEST_CHANNEL_NAME = "channel_name";
private static final String TEST_PARENT_CHANNEL_ID = "parent_channel_id";
private static final String TEST_CONVERSATION_ID = "conversation_id";
+ private static final int WIDGET_ID_WITH_SHORTCUT = 1;
+ private static final int WIDGET_ID_WITHOUT_SHORTCUT = 2;
+ private static final String SHORTCUT_ID = "101";
private PeopleSpaceWidgetManager mManager;
- @Mock private NotificationListener mListenerService;
- @Mock private IAppWidgetService mIAppWidgetService;
- @Mock private Context mContext;
+ @Mock
+ private NotificationListener mListenerService;
+ @Mock
+ private IAppWidgetService mIAppWidgetService;
+ @Mock
+ private AppWidgetManager mAppWidgetManager;
+ @Mock
+ private INotificationManager mINotificationManager;
- @Captor private ArgumentCaptor<NotificationHandler> mListenerCaptor;
+ @Captor
+ private ArgumentCaptor<NotificationHandler> mListenerCaptor;
private final NoManSimulator mNoMan = new NoManSimulator();
private final FakeSystemClock mClock = new FakeSystemClock();
@@ -80,18 +100,18 @@
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
-
mManager =
new PeopleSpaceWidgetManager(mContext);
- mManager.setAppWidgetManager(mIAppWidgetService);
+ mManager.setAppWidgetManager(mIAppWidgetService, mAppWidgetManager, mINotificationManager);
mManager.attach(mListenerService);
verify(mListenerService).addNotificationHandler(mListenerCaptor.capture());
NotificationHandler serviceListener = requireNonNull(mListenerCaptor.getValue());
mNoMan.addListener(serviceListener);
+ Settings.Global.putInt(mContext.getContentResolver(),
+ Settings.Global.PEOPLE_SPACE_CONVERSATION_TYPE, 2);
}
-
@Test
public void testDoNotNotifyAppWidgetIfNoWidgets() throws RemoteException {
int[] widgetIdsArray = {};
@@ -105,7 +125,24 @@
verify(mIAppWidgetService, times(1)).getAppWidgetIds(any());
verify(mIAppWidgetService, never()).notifyAppWidgetViewDataChanged(any(), any(), anyInt());
+ }
+ @Test
+ public void testDoNotNotifySingleConversationAppWidgetIfNoWidgets() throws RemoteException {
+ Settings.Global.putInt(mContext.getContentResolver(),
+ Settings.Global.PEOPLE_SPACE_CONVERSATION_TYPE, 0);
+ int[] widgetIdsArray = {};
+ when(mIAppWidgetService.getAppWidgetIds(any())).thenReturn(widgetIdsArray);
+
+ NotifEvent notif1 = mNoMan.postNotif(
+ new NotificationEntryBuilder()
+ .setId(0)
+ .setPkg(TEST_PACKAGE_A));
+ mClock.advanceTime(MIN_LINGER_DURATION);
+
+ verify(mIAppWidgetService, times(1)).getAppWidgetIds(any());
+ verify(mAppWidgetManager, never()).updateAppWidget(anyInt(), any(RemoteViews.class));
+ verify(mIAppWidgetService, never()).notifyAppWidgetViewDataChanged(any(), any(), anyInt());
}
@Test
@@ -122,7 +159,66 @@
verify(mIAppWidgetService, times(1)).getAppWidgetIds(any());
verify(mIAppWidgetService, times(1))
.notifyAppWidgetViewDataChanged(any(), eq(widgetIdsArray), anyInt());
+ verify(mIAppWidgetService, never()).updateAppWidgetIds(any(), any(),
+ any(RemoteViews.class));
+ }
+ @Test
+ public void testNotifySingleConversationAppWidgetOnceIfNotificationPosted()
+ throws RemoteException {
+ Settings.Global.putInt(mContext.getContentResolver(),
+ Settings.Global.PEOPLE_SPACE_CONVERSATION_TYPE, 0);
+ when(mINotificationManager.getConversations(true)).thenReturn(
+ new ParceledListSlice(getConversationWithShortcutId()));
+ int[] widgetIdsArray = {WIDGET_ID_WITH_SHORTCUT, WIDGET_ID_WITHOUT_SHORTCUT};
+ SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mContext);
+ SharedPreferences.Editor editor = sp.edit();
+ editor.putString(String.valueOf(WIDGET_ID_WITH_SHORTCUT), SHORTCUT_ID);
+ editor.commit();
+ when(mIAppWidgetService.getAppWidgetIds(any())).thenReturn(widgetIdsArray);
+
+ NotifEvent notif1 = mNoMan.postNotif(new NotificationEntryBuilder()
+ .setPkg(TEST_PACKAGE_A)
+ .setId(1));
+
+ verify(mIAppWidgetService, times(1)).getAppWidgetIds(any());
+ verify(mIAppWidgetService, never())
+ .notifyAppWidgetViewDataChanged(any(), eq(widgetIdsArray), anyInt());
+ verify(mAppWidgetManager, times(1)).updateAppWidget(eq(WIDGET_ID_WITH_SHORTCUT),
+ any(RemoteViews.class));
+ verify(mAppWidgetManager, never()).updateAppWidget(eq(WIDGET_ID_WITHOUT_SHORTCUT),
+ any(RemoteViews.class));
+ }
+
+ @Test
+ public void testNotifySingleConversationAppWidgetTwiceIfTwoNotificationsPosted()
+ throws RemoteException {
+ Settings.Global.putInt(mContext.getContentResolver(),
+ Settings.Global.PEOPLE_SPACE_CONVERSATION_TYPE, 0);
+ when(mINotificationManager.getConversations(true)).thenReturn(
+ new ParceledListSlice(getConversationWithShortcutId()));
+ int[] widgetIdsArray = {WIDGET_ID_WITH_SHORTCUT, WIDGET_ID_WITHOUT_SHORTCUT};
+ SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mContext);
+ SharedPreferences.Editor editor = sp.edit();
+ editor.putString(String.valueOf(WIDGET_ID_WITH_SHORTCUT), SHORTCUT_ID);
+ editor.commit();
+ when(mIAppWidgetService.getAppWidgetIds(any())).thenReturn(widgetIdsArray);
+
+ NotifEvent notif1 = mNoMan.postNotif(new NotificationEntryBuilder()
+ .setPkg(TEST_PACKAGE_A)
+ .setId(1));
+ mClock.advanceTime(4);
+ NotifEvent notif2 = mNoMan.postNotif(new NotificationEntryBuilder()
+ .setPkg(TEST_PACKAGE_B)
+ .setId(2));
+
+ verify(mIAppWidgetService, times(2)).getAppWidgetIds(any());
+ verify(mIAppWidgetService, never())
+ .notifyAppWidgetViewDataChanged(any(), eq(widgetIdsArray), anyInt());
+ verify(mAppWidgetManager, times(2)).updateAppWidget(eq(WIDGET_ID_WITH_SHORTCUT),
+ any(RemoteViews.class));
+ verify(mAppWidgetManager, never()).updateAppWidget(eq(WIDGET_ID_WITHOUT_SHORTCUT),
+ any(RemoteViews.class));
}
@Test
@@ -141,6 +237,8 @@
verify(mIAppWidgetService, times(2)).getAppWidgetIds(any());
verify(mIAppWidgetService, times(2))
.notifyAppWidgetViewDataChanged(any(), eq(widgetIdsArray), anyInt());
+ verify(mAppWidgetManager, never()).updateAppWidget(anyInt(),
+ any(RemoteViews.class));
}
@Test
@@ -157,6 +255,8 @@
verify(mIAppWidgetService, times(2)).getAppWidgetIds(any());
verify(mIAppWidgetService, times(2))
.notifyAppWidgetViewDataChanged(any(), eq(widgetIdsArray), anyInt());
+ verify(mAppWidgetManager, never()).updateAppWidget(anyInt(),
+ any(RemoteViews.class));
}
@Test
@@ -173,7 +273,8 @@
verify(mIAppWidgetService, never()).getAppWidgetIds(any());
verify(mIAppWidgetService, never()).notifyAppWidgetViewDataChanged(any(), any(), anyInt());
-
+ verify(mAppWidgetManager, never()).updateAppWidget(anyInt(),
+ any(RemoteViews.class));
}
@Test
@@ -192,6 +293,17 @@
verify(mIAppWidgetService, times(1)).getAppWidgetIds(any());
verify(mIAppWidgetService, times(1))
.notifyAppWidgetViewDataChanged(any(), eq(widgetIdsArray), anyInt());
+ verify(mAppWidgetManager, never()).updateAppWidget(anyInt(),
+ any(RemoteViews.class));
+ }
+ /** Returns a list of a single conversation associated with {@code SHORTCUT_ID}. */
+ private List<ConversationChannelWrapper> getConversationWithShortcutId() {
+ List<ConversationChannelWrapper> convos = new ArrayList<>();
+ ConversationChannelWrapper convo1 = new ConversationChannelWrapper();
+ convo1.setShortcutInfo(new ShortcutInfo.Builder(mContext, SHORTCUT_ID).setLongLabel(
+ "name").build());
+ convos.add(convo1);
+ return convos;
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/FeedbackInfoTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/FeedbackInfoTest.java
index 738ce53..9d87579 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/FeedbackInfoTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/FeedbackInfoTest.java
@@ -28,7 +28,6 @@
import static junit.framework.Assert.assertTrue;
import static org.mockito.Mockito.any;
-import static org.mockito.Mockito.anyBoolean;
import static org.mockito.Mockito.anyInt;
import static org.mockito.Mockito.anyString;
import static org.mockito.Mockito.eq;
@@ -56,6 +55,7 @@
import com.android.internal.statusbar.IStatusBarService;
import com.android.systemui.R;
import com.android.systemui.SysuiTestCase;
+import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;
import com.android.systemui.statusbar.notification.AssistantFeedbackController;
import com.android.systemui.statusbar.notification.NotificationEntryManager;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
@@ -65,8 +65,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
-
-import java.util.concurrent.CountDownLatch;
+import org.mockito.MockitoAnnotations;
@SmallTest
@RunWith(AndroidTestingRunner.class)
@@ -78,18 +77,24 @@
private FeedbackInfo mFeedbackInfo;
private final PackageManager mMockPackageManager = mock(PackageManager.class);
private final NotificationGuts mGutsParent = mock(NotificationGuts.class);
+ private final ExpandableNotificationRow mMockNotificationRow =
+ mock(ExpandableNotificationRow.class);
private StatusBarNotification mSbn;
@Mock
private NotificationEntryManager mNotificationEntryManager;
@Mock
private IStatusBarService mStatusBarService;
+ @Mock
+ private NotificationGutsManager mNotificationGutsManager;
@Before
public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
mDependency.injectTestDependency(NotificationEntryManager.class, mNotificationEntryManager);
mDependency.injectTestDependency(IStatusBarService.class, mStatusBarService);
+ mDependency.injectTestDependency(NotificationGutsManager.class, mNotificationGutsManager);
// Inflate the layout
final LayoutInflater layoutInflater = LayoutInflater.from(mContext);
@@ -108,13 +113,14 @@
mSbn = new StatusBarNotification(TEST_PACKAGE_NAME, TEST_PACKAGE_NAME, 0, null, TEST_UID, 0,
new Notification(), UserHandle.CURRENT, null, 0);
+
}
@Test
public void testBindNotification_SetsTextApplicationName() {
when(mMockPackageManager.getApplicationLabel(any())).thenReturn("App Name");
mFeedbackInfo.bindGuts(mMockPackageManager, mSbn, getEntry(),
- mock(AssistantFeedbackController.class));
+ mMockNotificationRow, mock(AssistantFeedbackController.class));
final TextView textView = mFeedbackInfo.findViewById(R.id.pkg_name);
assertTrue(textView.getText().toString().contains("App Name"));
}
@@ -125,27 +131,16 @@
when(mMockPackageManager.getApplicationIcon(any(ApplicationInfo.class)))
.thenReturn(iconDrawable);
mFeedbackInfo.bindGuts(mMockPackageManager, mSbn, getEntry(),
- mock(AssistantFeedbackController.class));
+ mMockNotificationRow, mock(AssistantFeedbackController.class));
final ImageView iconView = mFeedbackInfo.findViewById(R.id.pkg_icon);
assertEquals(iconDrawable, iconView.getDrawable());
}
@Test
- public void testOk() {
- final CountDownLatch latch = new CountDownLatch(1);
- mFeedbackInfo.bindGuts(mMockPackageManager, mSbn, getEntry(),
- mock(AssistantFeedbackController.class));
-
- final View okButton = mFeedbackInfo.findViewById(R.id.ok);
- okButton.performClick();
- assertEquals(1, latch.getCount());
- verify(mGutsParent, times(1)).closeControls(any(), anyBoolean());
- }
-
- @Test
public void testPrompt_silenced() {
mFeedbackInfo.bindGuts(mMockPackageManager, mSbn, getEntry(IMPORTANCE_DEFAULT,
- IMPORTANCE_LOW, RANKING_UNCHANGED), mock(AssistantFeedbackController.class));
+ IMPORTANCE_LOW, RANKING_UNCHANGED), mMockNotificationRow,
+ mock(AssistantFeedbackController.class));
TextView prompt = mFeedbackInfo.findViewById(R.id.prompt);
assertEquals("This notification was silenced by the system. Was this correct?",
prompt.getText());
@@ -154,7 +149,8 @@
@Test
public void testPrompt_promoted_importance() {
mFeedbackInfo.bindGuts(mMockPackageManager, mSbn, getEntry(IMPORTANCE_DEFAULT,
- IMPORTANCE_HIGH, RANKING_UNCHANGED), mock(AssistantFeedbackController.class));
+ IMPORTANCE_HIGH, RANKING_UNCHANGED), mMockNotificationRow,
+ mock(AssistantFeedbackController.class));
TextView prompt = mFeedbackInfo.findViewById(R.id.prompt);
assertEquals("This notification was promoted by the system. Was this correct?",
prompt.getText());
@@ -163,7 +159,8 @@
@Test
public void testPrompt_promoted_ranking() {
mFeedbackInfo.bindGuts(mMockPackageManager, mSbn, getEntry(IMPORTANCE_DEFAULT,
- IMPORTANCE_DEFAULT, RANKING_PROMOTED), mock(AssistantFeedbackController.class));
+ IMPORTANCE_DEFAULT, RANKING_PROMOTED), mMockNotificationRow,
+ mock(AssistantFeedbackController.class));
TextView prompt = mFeedbackInfo.findViewById(R.id.prompt);
assertEquals("This notification was promoted by the system. Was this correct?",
prompt.getText());
@@ -172,7 +169,8 @@
@Test
public void testPrompt_demoted_importance() {
mFeedbackInfo.bindGuts(mMockPackageManager, mSbn, getEntry(IMPORTANCE_LOW,
- IMPORTANCE_MIN, RANKING_UNCHANGED), mock(AssistantFeedbackController.class));
+ IMPORTANCE_MIN, RANKING_UNCHANGED), mMockNotificationRow,
+ mock(AssistantFeedbackController.class));
TextView prompt = mFeedbackInfo.findViewById(R.id.prompt);
assertEquals("This notification was demoted by the system. Was this correct?",
prompt.getText());
@@ -181,12 +179,43 @@
@Test
public void testPrompt_demoted_ranking() {
mFeedbackInfo.bindGuts(mMockPackageManager, mSbn, getEntry(IMPORTANCE_DEFAULT,
- IMPORTANCE_DEFAULT, RANKING_DEMOTED), mock(AssistantFeedbackController.class));
+ IMPORTANCE_DEFAULT, RANKING_DEMOTED), mMockNotificationRow,
+ mock(AssistantFeedbackController.class));
TextView prompt = mFeedbackInfo.findViewById(R.id.prompt);
assertEquals("This notification was demoted by the system. Was this correct?",
prompt.getText());
}
+ @Test
+ public void testPositiveFeedback() {
+ mFeedbackInfo.bindGuts(mMockPackageManager, mSbn, getEntry(), mMockNotificationRow,
+ mock(AssistantFeedbackController.class));
+
+ final View yes = mFeedbackInfo.findViewById(R.id.yes);
+ yes.performClick();
+ verify(mGutsParent, times(1)).closeControls(yes, false);
+ }
+
+ @Test
+ public void testNegativeFeedback() {
+ when(mNotificationGutsManager.openGuts(
+ any(View.class),
+ anyInt(),
+ anyInt(),
+ any(NotificationMenuRowPlugin.MenuItem.class)))
+ .thenReturn(true);
+
+ mFeedbackInfo.bindGuts(mMockPackageManager, mSbn, getEntry(), mMockNotificationRow,
+ mock(AssistantFeedbackController.class));
+
+ final View no = mFeedbackInfo.findViewById(R.id.no);
+ no.performClick();
+ verify(mGutsParent, times(1)).closeControls(no, false);
+ verify(mNotificationGutsManager, times(1)).openGuts(
+ eq(mMockNotificationRow), eq(0), eq(0),
+ any());
+ }
+
private NotificationEntry getEntry(int oldImportance, int newImportance,
int rankingAdjustment) {
NotificationChannel channel = new NotificationChannel("id", "name", oldImportance);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentViewTest.java
index d08b2b7..2101ea1 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentViewTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentViewTest.java
@@ -81,12 +81,15 @@
View mockContracted = mock(NotificationHeaderView.class);
when(mockContracted.findViewById(com.android.internal.R.id.feedback))
.thenReturn(mockContracted);
+ when(mockContracted.getContext()).thenReturn(mContext);
View mockExpanded = mock(NotificationHeaderView.class);
when(mockExpanded.findViewById(com.android.internal.R.id.feedback))
.thenReturn(mockExpanded);
+ when(mockExpanded.getContext()).thenReturn(mContext);
View mockHeadsUp = mock(NotificationHeaderView.class);
when(mockHeadsUp.findViewById(com.android.internal.R.id.feedback))
.thenReturn(mockHeadsUp);
+ when(mockHeadsUp.getContext()).thenReturn(mContext);
mView.setContractedChild(mockContracted);
mView.setExpandedChild(mockExpanded);
@@ -107,18 +110,21 @@
when(mockContracted.animate()).thenReturn(mock(ViewPropertyAnimator.class));
when(mockContracted.findViewById(com.android.internal.R.id.expand_button)).thenReturn(
mockContractedEB);
+ when(mockContracted.getContext()).thenReturn(mContext);
View mockExpandedEB = mock(NotificationExpandButton.class);
View mockExpanded = mock(NotificationHeaderView.class);
when(mockExpanded.animate()).thenReturn(mock(ViewPropertyAnimator.class));
when(mockExpanded.findViewById(com.android.internal.R.id.expand_button)).thenReturn(
mockExpandedEB);
+ when(mockExpanded.getContext()).thenReturn(mContext);
View mockHeadsUpEB = mock(NotificationExpandButton.class);
View mockHeadsUp = mock(NotificationHeaderView.class);
when(mockHeadsUp.animate()).thenReturn(mock(ViewPropertyAnimator.class));
when(mockHeadsUp.findViewById(com.android.internal.R.id.expand_button)).thenReturn(
mockHeadsUpEB);
+ when(mockHeadsUp.getContext()).thenReturn(mContext);
// Set up all 3 child forms
mView.setContractedChild(mockContracted);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationViewWrapperTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationViewWrapperTest.java
index 085bd90..93a9e59 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationViewWrapperTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationViewWrapperTest.java
@@ -17,6 +17,7 @@
package com.android.systemui.statusbar.notification.row.wrapper;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
import android.content.Context;
import android.testing.AndroidTestingRunner;
@@ -49,6 +50,7 @@
public void setup() throws Exception {
allowTestableLooperAsMainThread();
mView = mock(View.class);
+ when(mView.getContext()).thenReturn(mContext);
NotificationTestHelper helper = new NotificationTestHelper(
mContext,
mDependency,
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java
index 83ef87a..c7c1823 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java
@@ -19,7 +19,6 @@
import static com.google.common.truth.Truth.assertThat;
import android.testing.AndroidTestingRunner;
-import android.testing.TestableLooper;
import androidx.test.filters.SmallTest;
@@ -31,7 +30,6 @@
@SmallTest
@RunWith(AndroidTestingRunner.class)
[email protected]
public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
private static final int SCREEN_HEIGHT = 2000;
@@ -53,6 +51,7 @@
private int mPreferredClockY;
private boolean mHasCustomClock;
private boolean mHasVisibleNotifs;
+ private float mQsExpansion;
@Before
public void setUp() {
@@ -355,6 +354,17 @@
}
@Test
+ public void clockHiddenWhenQsIsExpanded() {
+ // GIVEN on the lock screen with a custom clock and visible notifications
+ givenLockScreen();
+ mQsExpansion = 1;
+ // WHEN the clock position algorithm is run
+ positionClock();
+ // THEN the clock Y position is the middle of the screen (SCREEN_HEIGHT / 2).
+ assertThat(mClockPosition.clockAlpha).isEqualTo(TRANSPARENT);
+ }
+
+ @Test
public void preferredCustomClockPositionWithVisibleNotificationsOnAod() {
// GIVEN on the lock screen with a custom clock and visible notifications
givenAOD();
@@ -384,7 +394,7 @@
mClockPositionAlgorithm.setup(EMPTY_MARGIN, SCREEN_HEIGHT, mNotificationStackHeight,
mPanelExpansion, SCREEN_HEIGHT, mKeyguardStatusHeight, mPreferredClockY,
mHasCustomClock, mHasVisibleNotifs, mDark, ZERO_DRAG, false /* bypassEnabled */,
- 0 /* unlockedStackScrollerPadding */, false /* udfpsEnrolled */);
+ 0 /* unlockedStackScrollerPadding */, false /* udfpsEnrolled */, mQsExpansion);
mClockPositionAlgorithm.run(mClockPosition);
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java
index d4a94a1..d452861 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java
@@ -199,6 +199,8 @@
@Mock
private AuthController mAuthController;
@Mock
+ private ScrimController mScrimController;
+ @Mock
private MediaDataManager mMediaDataManager;
private NotificationPanelViewController mNotificationPanelViewController;
@@ -279,6 +281,7 @@
mNotificationAreaController,
mAuthController,
new QSDetailDisplayer(),
+ mScrimController,
mMediaDataManager);
mNotificationPanelViewController.initDependencies(
mStatusBar,
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 eaf31ed..342b2f5 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
@@ -249,6 +249,20 @@
}
@Test
+ public void transitionToShadeLocked() {
+ mScrimController.transitionTo(ScrimState.SHADE_LOCKED);
+ finishAnimationsImmediately();
+
+ assertScrimAlpha(TRANSPARENT /* front */,
+ OPAQUE /* back */,
+ TRANSPARENT /* bubble */);
+
+ assertScrimTint(false /* front */,
+ false /* behind */,
+ false /* bubble */);
+ }
+
+ @Test
public void transitionToOff() {
mScrimController.transitionTo(ScrimState.OFF);
finishAnimationsImmediately();
@@ -464,7 +478,7 @@
// Front scrim should be transparent
// Back scrim should be visible without tint
assertScrimAlpha(TRANSPARENT /* front */,
- SEMI_TRANSPARENT /* back */,
+ OPAQUE /* back */,
TRANSPARENT /* bubble */);
assertScrimTint(false /* front */,
@@ -478,7 +492,7 @@
finishAnimationsImmediately();
// Front scrim should be transparent
// Back scrim should be visible without tint
- assertScrimAlpha(SEMI_TRANSPARENT /* front */,
+ assertScrimAlpha(OPAQUE /* front */,
TRANSPARENT /* back */,
TRANSPARENT /* bubble */);
assertScrimTint(false /* front */,
@@ -519,11 +533,11 @@
Assert.assertEquals(ScrimController.TRANSPARENT,
mScrimInFront.getViewAlpha(), 0.0f);
// Back scrim should be visible
- Assert.assertEquals(ScrimController.BLUR_SCRIM_ALPHA,
+ Assert.assertEquals(ScrimController.BUSY_SCRIM_ALPHA,
mScrimBehind.getViewAlpha(), 0.0f);
// Bubble scrim should be visible
- Assert.assertEquals(ScrimController.BLUR_SCRIM_ALPHA,
- mScrimBehind.getViewAlpha(), 0.0f);
+ Assert.assertEquals(ScrimController.BUBBLE_SCRIM_ALPHA,
+ mScrimForBubble.getViewAlpha(), 0.0f);
}
@Test
@@ -564,6 +578,15 @@
}
@Test
+ public void qsExpansion() {
+ reset(mScrimBehind);
+ mScrimController.setQsExpansion(1f);
+ finishAnimationsImmediately();
+
+ assertScrimAlpha(TRANSPARENT, OPAQUE, TRANSPARENT);
+ }
+
+ @Test
public void panelExpansionAffectsAlpha() {
mScrimController.setPanelExpansion(0f);
mScrimController.setPanelExpansion(0.5f);
@@ -888,7 +911,7 @@
HashSet<ScrimState> regularStates = new HashSet<>(Arrays.asList(
ScrimState.UNINITIALIZED, ScrimState.KEYGUARD, ScrimState.BOUNCER,
ScrimState.BOUNCER_SCRIMMED, ScrimState.BRIGHTNESS_MIRROR, ScrimState.UNLOCKED,
- ScrimState.BUBBLE_EXPANDED));
+ ScrimState.BUBBLE_EXPANDED, ScrimState.SHADE_LOCKED));
for (ScrimState state : ScrimState.values()) {
if (!lowPowerModeStates.contains(state) && !regularStates.contains(state)) {
diff --git a/packages/Tethering/OWNERS b/packages/Tethering/OWNERS
new file mode 100644
index 0000000..aa87958
--- /dev/null
+++ b/packages/Tethering/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/net/OWNERS
diff --git a/packages/VpnDialogs/OWNERS b/packages/VpnDialogs/OWNERS
new file mode 100644
index 0000000..aa87958
--- /dev/null
+++ b/packages/VpnDialogs/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/net/OWNERS
diff --git a/packages/WAPPushManager/OWNERS b/packages/WAPPushManager/OWNERS
new file mode 100644
index 0000000..640baf2
--- /dev/null
+++ b/packages/WAPPushManager/OWNERS
@@ -0,0 +1 @@
+include /telephony/OWNERS
diff --git a/packages/WallpaperBackup/OWNERS b/packages/WallpaperBackup/OWNERS
new file mode 100644
index 0000000..d99779e
--- /dev/null
+++ b/packages/WallpaperBackup/OWNERS
@@ -0,0 +1 @@
+include /services/backup/OWNERS
diff --git a/packages/WallpaperCropper/OWNERS b/packages/WallpaperCropper/OWNERS
new file mode 100644
index 0000000..8ff0f74
--- /dev/null
+++ b/packages/WallpaperCropper/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/service/wallpaper/OWNERS
diff --git a/packages/WindowManager/OWNERS b/packages/WindowManager/OWNERS
new file mode 100644
index 0000000..0862c05
--- /dev/null
+++ b/packages/WindowManager/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/wm/OWNERS
diff --git a/packages/overlays/OWNERS b/packages/overlays/OWNERS
new file mode 100644
index 0000000..afb98d4
--- /dev/null
+++ b/packages/overlays/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/content/om/OWNERS
diff --git a/packages/services/PacProcessor/OWNERS b/packages/services/PacProcessor/OWNERS
new file mode 100644
index 0000000..aa87958
--- /dev/null
+++ b/packages/services/PacProcessor/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/net/OWNERS
diff --git a/packages/services/Proxy/OWNERS b/packages/services/Proxy/OWNERS
new file mode 100644
index 0000000..aa87958
--- /dev/null
+++ b/packages/services/Proxy/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/net/OWNERS
diff --git a/proto/src/OWNERS b/proto/src/OWNERS
new file mode 100644
index 0000000..e7ddf86
--- /dev/null
+++ b/proto/src/OWNERS
@@ -0,0 +1,2 @@
+per-file gnss.proto = file:/services/core/java/com/android/server/location/OWNERS
+per-file wifi.proto = file:/wifi/OWNERS
diff --git a/proto/src/metrics_constants/OWNERS b/proto/src/metrics_constants/OWNERS
index 7009282..ab4d808 100644
--- a/proto/src/metrics_constants/OWNERS
+++ b/proto/src/metrics_constants/OWNERS
@@ -1,4 +1,4 @@
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/samples/training/network-usage/OWNERS b/samples/training/network-usage/OWNERS
new file mode 100644
index 0000000..aa87958
--- /dev/null
+++ b/samples/training/network-usage/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/net/OWNERS
diff --git a/services/OWNERS b/services/OWNERS
new file mode 100644
index 0000000..88d0b61
--- /dev/null
+++ b/services/OWNERS
@@ -0,0 +1 @@
+per-file Android.bp = file:platform/build/soong:/OWNERS
diff --git a/services/api/OWNERS b/services/api/OWNERS
new file mode 100644
index 0000000..a609390
--- /dev/null
+++ b/services/api/OWNERS
@@ -0,0 +1,4 @@
+per-file Android.bp = file:platform/build/soong:/OWNERS
+
+# API changes are managed via Prolog rules, not OWNERS
+*
diff --git a/services/appprediction/OWNERS b/services/appprediction/OWNERS
new file mode 100644
index 0000000..3a5d23d
--- /dev/null
+++ b/services/appprediction/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/service/appprediction/OWNERS
diff --git a/services/autofill/OWNERS b/services/autofill/OWNERS
new file mode 100644
index 0000000..c52751d
--- /dev/null
+++ b/services/autofill/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/service/autofill/OWNERS
diff --git a/services/contentcapture/OWNERS b/services/contentcapture/OWNERS
new file mode 100644
index 0000000..a28e00a
--- /dev/null
+++ b/services/contentcapture/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/service/contentcapture/OWNERS
diff --git a/services/contentsuggestions/OWNERS b/services/contentsuggestions/OWNERS
new file mode 100644
index 0000000..449db3a
--- /dev/null
+++ b/services/contentsuggestions/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/service/contentsuggestions/OWNERS
diff --git a/services/core/OWNERS b/services/core/OWNERS
new file mode 100644
index 0000000..88d0b61
--- /dev/null
+++ b/services/core/OWNERS
@@ -0,0 +1 @@
+per-file Android.bp = file:platform/build/soong:/OWNERS
diff --git a/services/core/java/com/android/server/IpSecService.java b/services/core/java/com/android/server/IpSecService.java
index b2f0c83..f648c3e 100644
--- a/services/core/java/com/android/server/IpSecService.java
+++ b/services/core/java/com/android/server/IpSecService.java
@@ -31,6 +31,7 @@
import android.content.pm.PackageManager;
import android.net.IIpSecService;
import android.net.INetd;
+import android.net.InetAddresses;
import android.net.IpSecAlgorithm;
import android.net.IpSecConfig;
import android.net.IpSecManager;
@@ -41,7 +42,6 @@
import android.net.IpSecUdpEncapResponse;
import android.net.LinkAddress;
import android.net.Network;
-import android.net.NetworkUtils;
import android.net.TrafficStats;
import android.net.util.NetdService;
import android.os.Binder;
@@ -1083,7 +1083,7 @@
throw new IllegalArgumentException("Unspecified address");
}
- InetAddress checkAddr = NetworkUtils.numericToInetAddress(inetAddress);
+ InetAddress checkAddr = InetAddresses.parseNumericAddress(inetAddress);
if (checkAddr.isAnyLocalAddress()) {
throw new IllegalArgumentException("Inappropriate wildcard address: " + inetAddress);
@@ -1467,7 +1467,7 @@
private int getFamily(String inetAddress) {
int family = AF_UNSPEC;
- InetAddress checkAddress = NetworkUtils.numericToInetAddress(inetAddress);
+ InetAddress checkAddress = InetAddresses.parseNumericAddress(inetAddress);
if (checkAddress instanceof Inet4Address) {
family = AF_INET;
} else if (checkAddress instanceof Inet6Address) {
diff --git a/services/core/java/com/android/server/MasterClearReceiver.java b/services/core/java/com/android/server/MasterClearReceiver.java
index 793e342..e248b21 100644
--- a/services/core/java/com/android/server/MasterClearReceiver.java
+++ b/services/core/java/com/android/server/MasterClearReceiver.java
@@ -25,7 +25,6 @@
import android.os.UserHandle;
import android.os.storage.StorageManager;
import android.text.TextUtils;
-import android.util.Log;
import android.util.Slog;
import android.view.WindowManager;
@@ -59,6 +58,7 @@
.getString(com.android.internal.R.string.config_factoryResetPackage);
if (Intent.ACTION_FACTORY_RESET.equals(intent.getAction())
&& !TextUtils.isEmpty(factoryResetPackage)) {
+ Slog.i(TAG, "Re-directing intent to " + factoryResetPackage);
intent.setPackage(factoryResetPackage).setComponent(null);
context.sendBroadcastAsUser(intent, UserHandle.SYSTEM);
return;
@@ -77,9 +77,12 @@
@Override
public void run() {
try {
+ Slog.i(TAG, "Calling RecoverySystem.rebootWipeUserData(context, "
+ + "shutdown=" + shutdown + ", reason=" + reason
+ + ", forceWipe=" + forceWipe + ", wipeEsims=" + mWipeEsims + ")");
RecoverySystem
.rebootWipeUserData(context, shutdown, reason, forceWipe, mWipeEsims);
- Log.wtf(TAG, "Still running after master clear?!");
+ Slog.wtf(TAG, "Still running after master clear?!");
} catch (IOException e) {
Slog.e(TAG, "Can't perform master clear/factory reset", e);
} catch (SecurityException e) {
@@ -90,8 +93,10 @@
if (mWipeExternalStorage) {
// thr will be started at the end of this task.
+ Slog.i(TAG, "Wiping external storage on async task");
new WipeDataTask(context, thr).execute();
} else {
+ Slog.i(TAG, "NOT wiping external storage; starting thread " + thr.getName());
thr.start();
}
}
diff --git a/services/core/java/com/android/server/NetworkManagementService.java b/services/core/java/com/android/server/NetworkManagementService.java
index 821a967..5e86f85 100644
--- a/services/core/java/com/android/server/NetworkManagementService.java
+++ b/services/core/java/com/android/server/NetworkManagementService.java
@@ -58,7 +58,6 @@
import android.net.NetworkPolicyManager;
import android.net.NetworkStack;
import android.net.NetworkStats;
-import android.net.NetworkUtils;
import android.net.RouteInfo;
import android.net.TetherStatsParcel;
import android.net.UidRange;
@@ -803,7 +802,7 @@
InterfaceConfiguration cfg = new InterfaceConfiguration();
cfg.setHardwareAddress(p.hwAddr);
- final InetAddress addr = NetworkUtils.numericToInetAddress(p.ipv4Addr);
+ final InetAddress addr = InetAddresses.parseNumericAddress(p.ipv4Addr);
cfg.setLinkAddress(new LinkAddress(addr, p.prefixLength));
for (String flag : p.flags) {
cfg.setFlag(flag);
diff --git a/services/core/java/com/android/server/OWNERS b/services/core/java/com/android/server/OWNERS
index 8706cdf..48cbd54 100644
--- a/services/core/java/com/android/server/OWNERS
+++ b/services/core/java/com/android/server/OWNERS
@@ -9,3 +9,19 @@
# Userspace reboot
per-file UserspaceRebootLogger.java = [email protected], [email protected]
+
+per-file *Alarm* = file:/apex/jobscheduler/OWNERS
+per-file *AppOps* = file:/core/java/android/permission/OWNERS
+per-file *Bluetooth* = file:/core/java/android/bluetooth/OWNERS
+per-file *Gnss* = file:/services/core/java/com/android/server/location/OWNERS
+per-file *Location* = file:/services/core/java/com/android/server/location/OWNERS
+per-file *Network* = file:/services/core/java/com/android/server/net/OWNERS
+per-file *Storage* = file:/core/java/android/os/storage/OWNERS
+per-file *TimeUpdate* = file:/core/java/android/app/timezone/OWNERS
+per-file ConnectivityService.java = file:/services/core/java/com/android/server/net/OWNERS
+per-file IpSecService.java = file:/services/core/java/com/android/server/net/OWNERS
+per-file MmsServiceBroker.java = file:/telephony/OWNERS
+per-file NetIdManager.java = file:/services/core/java/com/android/server/net/OWNERS
+per-file PackageWatchdog.java = file:/services/core/java/com/android/server/rollback/OWNERS
+per-file TelephonyRegistry.java = file:/telephony/OWNERS
+per-file UiModeManagerService.java = file:/packages/SystemUI/OWNERS
diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java
index dbd27af4..c95bfd03 100644
--- a/services/core/java/com/android/server/StorageManagerService.java
+++ b/services/core/java/com/android/server/StorageManagerService.java
@@ -108,7 +108,6 @@
import android.os.storage.StorageVolume;
import android.os.storage.VolumeInfo;
import android.os.storage.VolumeRecord;
-import android.provider.DeviceConfig;
import android.provider.DocumentsContract;
import android.provider.Downloads;
import android.provider.MediaStore;
@@ -206,27 +205,6 @@
private static final String ANDROID_VOLD_APP_DATA_ISOLATION_ENABLED_PROPERTY =
"persist.sys.vold_app_data_isolation_enabled";
- // TODO(b/169327180): Will be fetched from the server, but for now, we emulate this in
- // the system_server since it can write to DeviceConfig and MediaProvider can read it
- private static final String PROP_TRANSCODE_ENABLED = "transcode_enabled";
- private static final String PROP_TRANSCODE_DEFAULT = "transcode_default";
- private static final String PROP_TRANSCODE_COMPAT_MANIFEST = "transcode_compat_manifest";
- private static final boolean TRANSCODE_ENABLED_VALUE = false;
- // Determines the default behavior of apps when transcode is enabled, AKA, Option A/Option B.
- // If true, transcode by default (Option B). If false, don't transcode by default (Option A)
- // For dogfood, we go with Option B
- private static final boolean TRANSCODE_DEFAULT_VALUE = true;
- // Format is <package_name>,<media_capability_bit_mask>,...
- // media_capability_bit_mask is defined in MediaProvider/../TranscodeHelper.java:
- // FLAG_HEVC = 1 << 0;
- // FLAG_SLOW_MOTION = 1 << 1;
- // FLAG_HDR_10 = 1 << 2;
- // FLAG_HDR_10_PLUS = 1 << 3;
- // FLAG_HDR_HLG = 1 << 4;
- // FLAG_HDR_DOLBY_VISION = 1 << 5;
- private static final String TRANSCODE_COMPAT_MANIFEST_VALUE =
- "com.google.android.apps.photos,1";
-
// How long we wait to reset storage, if we failed to call onMount on the
// external storage service.
public static final int FAILED_MOUNT_RESET_TIMEOUT_SECONDS = 10;
@@ -901,18 +879,6 @@
com.android.internal.R.bool.config_zramWriteback)) {
ZramWriteback.scheduleZramWriteback(mContext);
}
-
- // TODO(b/169327180): Remove after setting up server-side DeviceConfig flags
- // Set DeviceConfig values for transcoding that will be read by MediaProvider
- DeviceConfig.setProperty(DeviceConfig.NAMESPACE_STORAGE_NATIVE_BOOT,
- PROP_TRANSCODE_ENABLED, String.valueOf(TRANSCODE_ENABLED_VALUE),
- false /* makeDefault */);
- DeviceConfig.setProperty(DeviceConfig.NAMESPACE_STORAGE_NATIVE_BOOT,
- PROP_TRANSCODE_DEFAULT, String.valueOf(TRANSCODE_DEFAULT_VALUE),
- false /* makeDefault */);
- DeviceConfig.setProperty(DeviceConfig.NAMESPACE_STORAGE_NATIVE_BOOT,
- PROP_TRANSCODE_COMPAT_MANIFEST, TRANSCODE_COMPAT_MANIFEST_VALUE,
- false /* makeDefault */);
}
/**
diff --git a/services/core/java/com/android/server/adb/OWNERS b/services/core/java/com/android/server/adb/OWNERS
new file mode 100644
index 0000000..b97f795
--- /dev/null
+++ b/services/core/java/com/android/server/adb/OWNERS
@@ -0,0 +1 @@
+include platform/packages/modules/adb:/OWNERS
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 0f9e9ee..18cc9a0 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -17225,8 +17225,6 @@
throw new SecurityException("Shell can delegate permissions only "
+ "to one instrumentation at a time");
}
- delegate.setPermissions(permissions);
- return;
}
final int instrCount = mActiveInstrumentation.size();
@@ -17269,7 +17267,8 @@
private class ShellDelegate implements CheckOpsDelegate {
private final int mTargetUid;
- private @Nullable String[] mPermissions;
+ @Nullable
+ private final String[] mPermissions;
ShellDelegate(int targetUid, @Nullable String[] permissions) {
mTargetUid = targetUid;
@@ -17280,11 +17279,6 @@
return mTargetUid;
}
- void setPermissions(@Nullable String[] permissions) {
- mPermissions = permissions;
- PackageManager.invalidatePackageInfoCache();
- }
-
@Override
public int checkOperation(int code, int uid, String packageName, boolean raw,
QuadFunction<Integer, Integer, String, Boolean, Integer> superImpl) {
diff --git a/services/core/java/com/android/server/appop/OWNERS b/services/core/java/com/android/server/appop/OWNERS
new file mode 100644
index 0000000..999ea0e
--- /dev/null
+++ b/services/core/java/com/android/server/appop/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/permission/OWNERS
diff --git a/services/core/java/com/android/server/attention/OWNERS b/services/core/java/com/android/server/attention/OWNERS
new file mode 100644
index 0000000..51fc9bd
--- /dev/null
+++ b/services/core/java/com/android/server/attention/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/attention/OWNERS
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java
index 4d971a5..6bc927a 100644
--- a/services/core/java/com/android/server/audio/AudioService.java
+++ b/services/core/java/com/android/server/audio/AudioService.java
@@ -2108,6 +2108,12 @@
return getDevicesForAttributesInt(attributes);
}
+ /** @see AudioManager#isMusicActive() */
+ public boolean isMusicActive() {
+ // no permission required
+ return AudioSystem.isStreamActive(AudioSystem.STREAM_MUSIC, 0);
+ }
+
protected @NonNull ArrayList<AudioDeviceAttributes> getDevicesForAttributesInt(
@NonNull AudioAttributes attributes) {
Objects.requireNonNull(attributes);
@@ -7444,8 +7450,8 @@
private static final int UNSAFE_VOLUME_MUSIC_ACTIVE_MS_MAX = (20 * 3600 * 1000); // 20 hours
private static final int MUSIC_ACTIVE_POLL_PERIOD_MS = 60000; // 1 minute polling interval
private static final int SAFE_VOLUME_CONFIGURE_TIMEOUT_MS = 30000; // 30s after boot completed
- // check playback or record activity every 3 seconds for UIDs owning mode IN_COMMUNICATION
- private static final int CHECK_MODE_FOR_UID_PERIOD_MS = 3000;
+ // check playback or record activity every 6 seconds for UIDs owning mode IN_COMMUNICATION
+ private static final int CHECK_MODE_FOR_UID_PERIOD_MS = 6000;
private int safeMediaVolumeIndex(int device) {
if (!mSafeMediaVolumeDevices.contains(device)) {
diff --git a/services/core/java/com/android/server/backup/OWNERS b/services/core/java/com/android/server/backup/OWNERS
new file mode 100644
index 0000000..d99779e
--- /dev/null
+++ b/services/core/java/com/android/server/backup/OWNERS
@@ -0,0 +1 @@
+include /services/backup/OWNERS
diff --git a/services/core/java/com/android/server/camera/OWNERS b/services/core/java/com/android/server/camera/OWNERS
new file mode 100644
index 0000000..f48a95c
--- /dev/null
+++ b/services/core/java/com/android/server/camera/OWNERS
@@ -0,0 +1 @@
+include platform/frameworks/av:/camera/OWNERS
diff --git a/services/core/java/com/android/server/connectivity/DnsManager.java b/services/core/java/com/android/server/connectivity/DnsManager.java
index 1f0fb5e..712ef76 100644
--- a/services/core/java/com/android/server/connectivity/DnsManager.java
+++ b/services/core/java/com/android/server/connectivity/DnsManager.java
@@ -34,7 +34,6 @@
import android.net.IDnsResolver;
import android.net.LinkProperties;
import android.net.Network;
-import android.net.NetworkUtils;
import android.net.ResolverOptionsParcel;
import android.net.ResolverParamsParcel;
import android.net.Uri;
@@ -50,6 +49,7 @@
import java.net.InetAddress;
import java.util.Arrays;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@@ -364,12 +364,11 @@
paramsParcel.successThreshold = mSuccessThreshold;
paramsParcel.minSamples = mMinSamples;
paramsParcel.maxSamples = mMaxSamples;
- paramsParcel.servers =
- NetworkUtils.makeStrings(lp.getDnsServers());
+ paramsParcel.servers = makeStrings(lp.getDnsServers());
paramsParcel.domains = getDomainStrings(lp.getDomains());
paramsParcel.tlsName = strictMode ? privateDnsCfg.hostname : "";
paramsParcel.tlsServers =
- strictMode ? NetworkUtils.makeStrings(
+ strictMode ? makeStrings(
Arrays.stream(privateDnsCfg.ips)
.filter((ip) -> lp.isReachable(ip))
.collect(Collectors.toList()))
@@ -460,6 +459,21 @@
return Settings.Global.getInt(mContentResolver, which, dflt);
}
+ /**
+ * Create a string array of host addresses from a collection of InetAddresses
+ *
+ * @param addrs a Collection of InetAddresses
+ * @return an array of Strings containing their host addresses
+ */
+ private String[] makeStrings(Collection<InetAddress> addrs) {
+ String[] result = new String[addrs.size()];
+ int i = 0;
+ for (InetAddress addr : addrs) {
+ result[i++] = addr.getHostAddress();
+ }
+ return result;
+ }
+
private static String getPrivateDnsMode(ContentResolver cr) {
String mode = getStringSetting(cr, PRIVATE_DNS_MODE);
if (TextUtils.isEmpty(mode)) mode = getStringSetting(cr, PRIVATE_DNS_DEFAULT_MODE);
diff --git a/services/core/java/com/android/server/connectivity/KeepaliveTracker.java b/services/core/java/com/android/server/connectivity/KeepaliveTracker.java
index 8625a6f..96cbfde 100644
--- a/services/core/java/com/android/server/connectivity/KeepaliveTracker.java
+++ b/services/core/java/com/android/server/connectivity/KeepaliveTracker.java
@@ -40,11 +40,11 @@
import android.annotation.Nullable;
import android.content.Context;
import android.net.ISocketKeepaliveCallback;
+import android.net.InetAddresses;
import android.net.InvalidPacketException;
import android.net.KeepalivePacketData;
import android.net.NattKeepalivePacketData;
import android.net.NetworkAgent;
-import android.net.NetworkUtils;
import android.net.SocketKeepalive.InvalidSocketException;
import android.net.TcpKeepalivePacketData;
import android.net.util.KeepaliveUtils;
@@ -625,8 +625,8 @@
InetAddress srcAddress, dstAddress;
try {
- srcAddress = NetworkUtils.numericToInetAddress(srcAddrString);
- dstAddress = NetworkUtils.numericToInetAddress(dstAddrString);
+ srcAddress = InetAddresses.parseNumericAddress(srcAddrString);
+ dstAddress = InetAddresses.parseNumericAddress(dstAddrString);
} catch (IllegalArgumentException e) {
notifyErrorCallback(cb, ERROR_INVALID_IP_ADDRESS);
return;
diff --git a/services/core/java/com/android/server/connectivity/NetworkDiagnostics.java b/services/core/java/com/android/server/connectivity/NetworkDiagnostics.java
index 49c16ad..a7be657 100644
--- a/services/core/java/com/android/server/connectivity/NetworkDiagnostics.java
+++ b/services/core/java/com/android/server/connectivity/NetworkDiagnostics.java
@@ -20,10 +20,10 @@
import android.annotation.NonNull;
import android.annotation.Nullable;
+import android.net.InetAddresses;
import android.net.LinkAddress;
import android.net.LinkProperties;
import android.net.Network;
-import android.net.NetworkUtils;
import android.net.RouteInfo;
import android.net.TrafficStats;
import android.net.shared.PrivateDnsConfig;
@@ -97,8 +97,8 @@
public class NetworkDiagnostics {
private static final String TAG = "NetworkDiagnostics";
- private static final InetAddress TEST_DNS4 = NetworkUtils.numericToInetAddress("8.8.8.8");
- private static final InetAddress TEST_DNS6 = NetworkUtils.numericToInetAddress(
+ private static final InetAddress TEST_DNS4 = InetAddresses.parseNumericAddress("8.8.8.8");
+ private static final InetAddress TEST_DNS6 = InetAddresses.parseNumericAddress(
"2001:4860:4860::8888");
// For brevity elsewhere.
diff --git a/services/core/java/com/android/server/contentcapture/OWNERS b/services/core/java/com/android/server/contentcapture/OWNERS
new file mode 100644
index 0000000..a28e00a
--- /dev/null
+++ b/services/core/java/com/android/server/contentcapture/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/service/contentcapture/OWNERS
diff --git a/services/core/java/com/android/server/dreams/OWNERS b/services/core/java/com/android/server/dreams/OWNERS
index 426f002..3c9bbf8 100644
--- a/services/core/java/com/android/server/dreams/OWNERS
+++ b/services/core/java/com/android/server/dreams/OWNERS
@@ -1,3 +1,3 @@
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/services/core/java/com/android/server/hdmi/OWNERS b/services/core/java/com/android/server/hdmi/OWNERS
new file mode 100644
index 0000000..c3c47ed
--- /dev/null
+++ b/services/core/java/com/android/server/hdmi/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/hardware/hdmi/OWNERS
diff --git a/services/core/java/com/android/server/incident/OWNERS b/services/core/java/com/android/server/incident/OWNERS
new file mode 100644
index 0000000..f766115
--- /dev/null
+++ b/services/core/java/com/android/server/incident/OWNERS
@@ -0,0 +1 @@
+include /cmds/incidentd/OWNERS
diff --git a/services/core/java/com/android/server/input/InputManagerService.java b/services/core/java/com/android/server/input/InputManagerService.java
index 42aad7d..a0121bb 100644
--- a/services/core/java/com/android/server/input/InputManagerService.java
+++ b/services/core/java/com/android/server/input/InputManagerService.java
@@ -51,6 +51,7 @@
import android.media.AudioManager;
import android.os.Binder;
import android.os.Bundle;
+import android.os.CombinedVibrationEffect;
import android.os.Environment;
import android.os.Handler;
import android.os.IBinder;
@@ -264,7 +265,11 @@
private static native void nativeReloadCalibration(long ptr);
private static native void nativeVibrate(long ptr, int deviceId, long[] pattern,
int[] amplitudes, int repeat, int token);
+ private static native void nativeVibrateCombined(long ptr, int deviceId, long[] pattern,
+ SparseArray<int[]> amplitudes, int repeat, int token);
private static native void nativeCancelVibrate(long ptr, int deviceId, int token);
+ private static native boolean nativeIsVibrating(long ptr, int deviceId);
+ private static native int[] nativeGetVibratorIds(long ptr, int deviceId);
private static native void nativeReloadKeyboardLayouts(long ptr);
private static native void nativeReloadDeviceAliases(long ptr);
private static native String nativeDump(long ptr);
@@ -1801,43 +1806,57 @@
return result;
}
- // Binder call
- @Override
- public void vibrate(int deviceId, VibrationEffect effect, IBinder token) {
- long[] pattern;
- int[] amplitudes;
- int repeat;
- if (effect instanceof VibrationEffect.OneShot) {
- VibrationEffect.OneShot oneShot = (VibrationEffect.OneShot) effect;
- pattern = new long[] { 0, oneShot.getDuration() };
- int amplitude = oneShot.getAmplitude();
- // android framework uses DEFAULT_AMPLITUDE to signal that the vibration
- // should use some built-in default value, denoted here as DEFAULT_VIBRATION_MAGNITUDE
- if (amplitude == VibrationEffect.DEFAULT_AMPLITUDE) {
- amplitude = DEFAULT_VIBRATION_MAGNITUDE;
- }
- amplitudes = new int[] { 0, amplitude };
- repeat = -1;
- } else if (effect instanceof VibrationEffect.Waveform) {
- VibrationEffect.Waveform waveform = (VibrationEffect.Waveform) effect;
- pattern = waveform.getTimings();
- amplitudes = waveform.getAmplitudes();
- for (int i = 0; i < amplitudes.length; i++) {
- if (amplitudes[i] == VibrationEffect.DEFAULT_AMPLITUDE) {
- amplitudes[i] = DEFAULT_VIBRATION_MAGNITUDE;
+ private static class VibrationInfo {
+ private long[] mPattern = new long[0];
+ private int[] mAmplitudes = new int[0];
+ private int mRepeat = -1;
+
+ public long[] getPattern() {
+ return mPattern;
+ }
+
+ public int[] getAmplitudes() {
+ return mAmplitudes;
+ }
+
+ public int getRepeatIndex() {
+ return mRepeat;
+ }
+
+ VibrationInfo(VibrationEffect effect) {
+ if (effect instanceof VibrationEffect.OneShot) {
+ VibrationEffect.OneShot oneShot = (VibrationEffect.OneShot) effect;
+ mPattern = new long[] { 0, oneShot.getDuration() };
+ int amplitude = oneShot.getAmplitude();
+ // android framework uses DEFAULT_AMPLITUDE to signal that the vibration
+ // should use some built-in default value, denoted here as
+ // DEFAULT_VIBRATION_MAGNITUDE
+ if (amplitude == VibrationEffect.DEFAULT_AMPLITUDE) {
+ amplitude = DEFAULT_VIBRATION_MAGNITUDE;
}
+ mAmplitudes = new int[] { 0, amplitude };
+ mRepeat = -1;
+ } else if (effect instanceof VibrationEffect.Waveform) {
+ VibrationEffect.Waveform waveform = (VibrationEffect.Waveform) effect;
+ mPattern = waveform.getTimings();
+ mAmplitudes = waveform.getAmplitudes();
+ for (int i = 0; i < mAmplitudes.length; i++) {
+ if (mAmplitudes[i] == VibrationEffect.DEFAULT_AMPLITUDE) {
+ mAmplitudes[i] = DEFAULT_VIBRATION_MAGNITUDE;
+ }
+ }
+ mRepeat = waveform.getRepeatIndex();
+ if (mRepeat >= mPattern.length) {
+ throw new ArrayIndexOutOfBoundsException();
+ }
+ } else {
+ // TODO: Add support for prebaked effects
+ Slog.w(TAG, "Pre-baked effects aren't supported on input devices");
}
- repeat = waveform.getRepeatIndex();
- } else {
- // TODO: Add support for prebaked effects
- Log.w(TAG, "Pre-baked effects aren't supported on input devices");
- return;
}
+ }
- if (repeat >= pattern.length) {
- throw new ArrayIndexOutOfBoundsException();
- }
-
+ private VibratorToken getVibratorToken(int deviceId, IBinder token) {
VibratorToken v;
synchronized (mVibratorLock) {
v = mVibratorTokens.get(token);
@@ -1852,9 +1871,70 @@
mVibratorTokens.put(token, v);
}
}
+ return v;
+ }
+
+ // Binder call
+ @Override
+ public void vibrate(int deviceId, VibrationEffect effect, IBinder token) {
+ VibrationInfo info = new VibrationInfo(effect);
+ VibratorToken v = getVibratorToken(deviceId, token);
synchronized (v) {
v.mVibrating = true;
- nativeVibrate(mPtr, deviceId, pattern, amplitudes, repeat, v.mTokenValue);
+ nativeVibrate(mPtr, deviceId, info.getPattern(), info.getAmplitudes(),
+ info.getRepeatIndex(), v.mTokenValue);
+ }
+ }
+
+ // Binder call
+ @Override
+ public int[] getVibratorIds(int deviceId) {
+ return nativeGetVibratorIds(mPtr, deviceId);
+ }
+
+ // Binder call
+ @Override
+ public boolean isVibrating(int deviceId) {
+ return nativeIsVibrating(mPtr, deviceId);
+ }
+
+ // Binder call
+ @Override
+ public void vibrateCombined(int deviceId, CombinedVibrationEffect effect, IBinder token) {
+ VibratorToken v = getVibratorToken(deviceId, token);
+ synchronized (v) {
+ if (!(effect instanceof CombinedVibrationEffect.Mono)
+ && !(effect instanceof CombinedVibrationEffect.Stereo)) {
+ Slog.e(TAG, "Only Mono and Stereo effects are supported");
+ return;
+ }
+
+ v.mVibrating = true;
+ if (effect instanceof CombinedVibrationEffect.Mono) {
+ CombinedVibrationEffect.Mono mono = (CombinedVibrationEffect.Mono) effect;
+ VibrationInfo info = new VibrationInfo(mono.getEffect());
+ nativeVibrate(mPtr, deviceId, info.getPattern(), info.getAmplitudes(),
+ info.getRepeatIndex(), v.mTokenValue);
+ } else if (effect instanceof CombinedVibrationEffect.Stereo) {
+ CombinedVibrationEffect.Stereo stereo = (CombinedVibrationEffect.Stereo) effect;
+ SparseArray<VibrationEffect> effects = stereo.getEffects();
+ long[] pattern = new long[0];
+ int repeat = Integer.MIN_VALUE;
+ SparseArray<int[]> amplitudes = new SparseArray<int[]>(effects.size());
+ for (int i = 0; i < effects.size(); i++) {
+ VibrationInfo info = new VibrationInfo(effects.valueAt(i));
+ // Pattern of all effects should be same
+ if (pattern.length == 0) {
+ pattern = info.getPattern();
+ }
+ if (repeat == Integer.MIN_VALUE) {
+ repeat = info.getRepeatIndex();
+ }
+ amplitudes.put(effects.keyAt(i), info.getAmplitudes());
+ }
+ nativeVibrateCombined(mPtr, deviceId, pattern, amplitudes, repeat,
+ v.mTokenValue);
+ }
}
}
diff --git a/services/core/java/com/android/server/location/gnss/GnssPowerStats.java b/services/core/java/com/android/server/location/gnss/GnssPowerStats.java
index 70ab3c6..b924d1f 100644
--- a/services/core/java/com/android/server/location/gnss/GnssPowerStats.java
+++ b/services/core/java/com/android/server/location/gnss/GnssPowerStats.java
@@ -16,8 +16,8 @@
package com.android.server.location.gnss;
-import static android.hardware.gnss.IGnss.ELAPSED_REALTIME_HAS_TIMESTAMP_NS;
-import static android.hardware.gnss.IGnss.ELAPSED_REALTIME_HAS_TIME_UNCERTAINTY_NS;
+import static android.hardware.gnss.ElapsedRealtime.HAS_TIMESTAMP_NS;
+import static android.hardware.gnss.ElapsedRealtime.HAS_TIME_UNCERTAINTY_NS;
import com.android.internal.util.Preconditions;
@@ -57,12 +57,12 @@
/** Returns true if {@link #getElapsedRealtimeNanos()} is available. */
public boolean hasElapsedRealtimeNanos() {
- return (mElapsedRealtimeFlags & ELAPSED_REALTIME_HAS_TIMESTAMP_NS) != 0;
+ return (mElapsedRealtimeFlags & HAS_TIMESTAMP_NS) != 0;
}
/** Returns true if {@link #getElapsedRealtimeUncertaintyNanos()} is available. */
public boolean hasElapsedRealtimeUncertaintyNanos() {
- return (mElapsedRealtimeFlags & ELAPSED_REALTIME_HAS_TIME_UNCERTAINTY_NS) != 0;
+ return (mElapsedRealtimeFlags & HAS_TIME_UNCERTAINTY_NS) != 0;
}
/**
diff --git a/services/core/java/com/android/server/locksettings/LockSettingsShellCommand.java b/services/core/java/com/android/server/locksettings/LockSettingsShellCommand.java
index c4581c8..834cf05 100644
--- a/services/core/java/com/android/server/locksettings/LockSettingsShellCommand.java
+++ b/services/core/java/com/android/server/locksettings/LockSettingsShellCommand.java
@@ -16,8 +16,6 @@
package com.android.server.locksettings;
-import static android.app.admin.DevicePolicyManager.PASSWORD_COMPLEXITY_NONE;
-
import static com.android.internal.widget.LockPatternUtils.CREDENTIAL_TYPE_NONE;
import static com.android.internal.widget.LockPatternUtils.CREDENTIAL_TYPE_PATTERN;
@@ -271,15 +269,17 @@
private boolean isNewCredentialSufficient(LockscreenCredential credential) {
final PasswordMetrics requiredMetrics =
mLockPatternUtils.getRequestedPasswordMetrics(mCurrentUserId);
+ final int requiredComplexity =
+ mLockPatternUtils.getRequestedPasswordComplexity(mCurrentUserId);
final List<PasswordValidationError> errors;
if (credential.isPassword() || credential.isPin()) {
- errors = PasswordMetrics.validatePassword(requiredMetrics, PASSWORD_COMPLEXITY_NONE,
+ errors = PasswordMetrics.validatePassword(requiredMetrics, requiredComplexity,
credential.isPin(), credential.getCredential());
} else {
PasswordMetrics metrics = new PasswordMetrics(
credential.isPattern() ? CREDENTIAL_TYPE_PATTERN : CREDENTIAL_TYPE_NONE);
errors = PasswordMetrics.validatePasswordMetrics(
- requiredMetrics, PASSWORD_COMPLEXITY_NONE, false /* isPin */, metrics);
+ requiredMetrics, requiredComplexity, false /* isPin */, metrics);
}
if (!errors.isEmpty()) {
getOutPrintWriter().println(
diff --git a/services/core/java/com/android/server/locksettings/OWNERS b/services/core/java/com/android/server/locksettings/OWNERS
new file mode 100644
index 0000000..dad6e39
--- /dev/null
+++ b/services/core/java/com/android/server/locksettings/OWNERS
@@ -0,0 +1,2 @@
[email protected]
[email protected]
diff --git a/services/core/java/com/android/server/net/IpConfigStore.java b/services/core/java/com/android/server/net/IpConfigStore.java
index f0bf5c0..9c5abd4 100644
--- a/services/core/java/com/android/server/net/IpConfigStore.java
+++ b/services/core/java/com/android/server/net/IpConfigStore.java
@@ -16,11 +16,11 @@
package com.android.server.net;
+import android.net.InetAddresses;
import android.net.IpConfiguration;
import android.net.IpConfiguration.IpAssignment;
import android.net.IpConfiguration.ProxySettings;
import android.net.LinkAddress;
-import android.net.NetworkUtils;
import android.net.ProxyInfo;
import android.net.RouteInfo;
import android.net.StaticIpConfiguration;
@@ -284,8 +284,10 @@
} else if (key.equals(IP_ASSIGNMENT_KEY)) {
ipAssignment = IpAssignment.valueOf(in.readUTF());
} else if (key.equals(LINK_ADDRESS_KEY)) {
- LinkAddress linkAddr = new LinkAddress(
- NetworkUtils.numericToInetAddress(in.readUTF()), in.readInt());
+ LinkAddress linkAddr =
+ new LinkAddress(
+ InetAddresses.parseNumericAddress(in.readUTF()),
+ in.readInt());
if (linkAddr.getAddress() instanceof Inet4Address &&
staticIpConfiguration.ipAddress == null) {
staticIpConfiguration.ipAddress = linkAddr;
@@ -297,7 +299,7 @@
InetAddress gateway = null;
if (version == 1) {
// only supported default gateways - leave the dest/prefix empty
- gateway = NetworkUtils.numericToInetAddress(in.readUTF());
+ gateway = InetAddresses.parseNumericAddress(in.readUTF());
if (staticIpConfiguration.gateway == null) {
staticIpConfiguration.gateway = gateway;
} else {
@@ -305,12 +307,13 @@
}
} else {
if (in.readInt() == 1) {
- dest = new LinkAddress(
- NetworkUtils.numericToInetAddress(in.readUTF()),
- in.readInt());
+ dest =
+ new LinkAddress(
+ InetAddresses.parseNumericAddress(in.readUTF()),
+ in.readInt());
}
if (in.readInt() == 1) {
- gateway = NetworkUtils.numericToInetAddress(in.readUTF());
+ gateway = InetAddresses.parseNumericAddress(in.readUTF());
}
RouteInfo route = new RouteInfo(dest, gateway);
if (route.isIPv4Default() &&
@@ -322,7 +325,7 @@
}
} else if (key.equals(DNS_KEY)) {
staticIpConfiguration.dnsServers.add(
- NetworkUtils.numericToInetAddress(in.readUTF()));
+ InetAddresses.parseNumericAddress(in.readUTF()));
} else if (key.equals(PROXY_SETTINGS_KEY)) {
proxySettings = ProxySettings.valueOf(in.readUTF());
} else if (key.equals(PROXY_HOST_KEY)) {
diff --git a/services/core/java/com/android/server/net/OWNERS b/services/core/java/com/android/server/net/OWNERS
index 28ae6a4..d5c7618 100644
--- a/services/core/java/com/android/server/net/OWNERS
+++ b/services/core/java/com/android/server/net/OWNERS
@@ -2,7 +2,7 @@
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/services/core/java/com/android/server/notification/OWNERS b/services/core/java/com/android/server/notification/OWNERS
index 5a19656..4dcb799 100644
--- a/services/core/java/com/android/server/notification/OWNERS
+++ b/services/core/java/com/android/server/notification/OWNERS
@@ -1,4 +1,4 @@
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/services/core/java/com/android/server/om/OWNERS b/services/core/java/com/android/server/om/OWNERS
new file mode 100644
index 0000000..afb98d4
--- /dev/null
+++ b/services/core/java/com/android/server/om/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/content/om/OWNERS
diff --git a/services/core/java/com/android/server/people/OWNERS b/services/core/java/com/android/server/people/OWNERS
new file mode 100644
index 0000000..3198a5e
--- /dev/null
+++ b/services/core/java/com/android/server/people/OWNERS
@@ -0,0 +1 @@
+include /services/people/OWNERS
diff --git a/services/core/java/com/android/server/pm/OWNERS b/services/core/java/com/android/server/pm/OWNERS
index cca2b83..7a2b7a6 100644
--- a/services/core/java/com/android/server/pm/OWNERS
+++ b/services/core/java/com/android/server/pm/OWNERS
@@ -1,12 +1,12 @@
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
# apex support
@@ -30,9 +30,10 @@
per-file CrossProfileAppsService.java = [email protected], [email protected]
per-file CrossProfileIntentFilter.java = [email protected], [email protected]
per-file CrossProfileIntentResolver.java = [email protected], [email protected]
+per-file RestrictionsSet.java = [email protected], [email protected], [email protected], [email protected], [email protected]
+per-file UserManagerInternal.java = [email protected], [email protected], [email protected]
per-file UserManagerService.java = [email protected], [email protected], [email protected]
per-file UserRestrictionsUtils.java = [email protected], [email protected], [email protected], [email protected]
-per-file RestrictionsSet.java = [email protected], [email protected], [email protected], [email protected], [email protected]
per-file UserSystemPackageInstaller.java = [email protected], [email protected], [email protected]
per-file UserTypeDetails.java = [email protected], [email protected], [email protected]
per-file UserTypeFactory.java = [email protected], [email protected], [email protected]
diff --git a/services/core/java/com/android/server/pm/PackageManagerShellCommand.java b/services/core/java/com/android/server/pm/PackageManagerShellCommand.java
index 318b229..2f6756d 100644
--- a/services/core/java/com/android/server/pm/PackageManagerShellCommand.java
+++ b/services/core/java/com/android/server/pm/PackageManagerShellCommand.java
@@ -27,7 +27,6 @@
import android.annotation.UserIdInt;
import android.app.ActivityManager;
import android.app.ActivityManagerInternal;
-import android.app.role.IRoleManager;
import android.app.role.RoleManager;
import android.content.ComponentName;
import android.content.Context;
@@ -80,7 +79,6 @@
import android.os.ParcelFileDescriptor.AutoCloseInputStream;
import android.os.PersistableBundle;
import android.os.Process;
-import android.os.RemoteCallback;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.ServiceSpecificException;
@@ -106,6 +104,7 @@
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.IndentingPrintWriter;
import com.android.internal.util.Preconditions;
+import com.android.server.FgThread;
import com.android.server.LocalServices;
import com.android.server.SystemConfig;
import com.android.server.pm.PackageManagerShellCommandDataLoader.Metadata;
@@ -2971,12 +2970,10 @@
final int translatedUserId =
translateUserId(userId, UserHandle.USER_NULL, "runSetHomeActivity");
final CompletableFuture<Boolean> future = new CompletableFuture<>();
- final RemoteCallback callback = new RemoteCallback(res -> future.complete(res != null));
try {
- IRoleManager roleManager = android.app.role.IRoleManager.Stub.asInterface(
- ServiceManager.getServiceOrThrow(Context.ROLE_SERVICE));
- roleManager.addRoleHolderAsUser(RoleManager.ROLE_HOME, pkgName,
- 0, translatedUserId, callback);
+ RoleManager roleManager = mContext.getSystemService(RoleManager.class);
+ roleManager.addRoleHolderAsUser(RoleManager.ROLE_HOME, pkgName, 0,
+ UserHandle.of(translatedUserId), FgThread.getExecutor(), future::complete);
boolean success = future.get();
if (success) {
pw.println("Success");
diff --git a/services/core/java/com/android/server/pm/permission/OWNERS b/services/core/java/com/android/server/pm/permission/OWNERS
index 0e88862..6e67830 100644
--- a/services/core/java/com/android/server/pm/permission/OWNERS
+++ b/services/core/java/com/android/server/pm/permission/OWNERS
@@ -1,7 +1,7 @@
[email protected]
[email protected]
-per-file DefaultPermissionGrantPolicy.java = [email protected]
-per-file DefaultPermissionGrantPolicy.java = [email protected]
+per-file DefaultPermissionGrantPolicy.java = [email protected]
+per-file DefaultPermissionGrantPolicy.java = [email protected]
per-file DefaultPermissionGrantPolicy.java = [email protected]
per-file DefaultPermissionGrantPolicy.java = [email protected]
per-file DefaultPermissionGrantPolicy.java = [email protected]
diff --git a/services/core/java/com/android/server/policy/OWNERS b/services/core/java/com/android/server/policy/OWNERS
new file mode 100644
index 0000000..0862c05
--- /dev/null
+++ b/services/core/java/com/android/server/policy/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/wm/OWNERS
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 75868e3..ea985df 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -2413,15 +2413,6 @@
wm = (WindowManager) context.getSystemService(WINDOW_SERVICE);
view = win.getDecorView();
- // Ignore to show splash screen if the decorView is not opaque.
- if (!view.isOpaque()) {
- if (DEBUG_SPLASH_SCREEN) {
- Slog.d(TAG, "addSplashScreen: the view of " + packageName
- + " is not opaque, cancel it");
- }
- return null;
- }
-
if (DEBUG_SPLASH_SCREEN) Slog.d(TAG, "Adding splash screen window for "
+ packageName + " / " + appToken + ": " + (view.getParent() != null ? view : null));
diff --git a/services/core/java/com/android/server/power/batterysaver/BatterySaverController.java b/services/core/java/com/android/server/power/batterysaver/BatterySaverController.java
index 68d038b..16f5069 100644
--- a/services/core/java/com/android/server/power/batterysaver/BatterySaverController.java
+++ b/services/core/java/com/android/server/power/batterysaver/BatterySaverController.java
@@ -113,11 +113,6 @@
private boolean mIsInteractive;
/**
- * Read-only list of plugins. No need for synchronization.
- */
- private final Plugin[] mPlugins;
-
- /**
* Package name that will receive an explicit manifest broadcast for
* {@link PowerManager#ACTION_POWER_SAVE_MODE_CHANGED}. It's {@code null} if it hasn't been
* retrieved yet.
@@ -172,15 +167,6 @@
}
}
- /**
- * Plugin interface. All methods are guaranteed to be called on the same (handler) thread.
- */
- public interface Plugin {
- void onSystemReady(BatterySaverController caller);
-
- void onBatterySaverChanged(BatterySaverController caller);
- }
-
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
@@ -194,6 +180,7 @@
updateBatterySavingStats();
return; // No need to send it if not enabled.
}
+ // We currently evaluate state only for CPU frequency changes.
// Don't send the broadcast, because we never did so in this case.
mHandler.postStateChanged(/*sendBroadcast=*/ false,
REASON_INTERACTIVE_CHANGED);
@@ -224,9 +211,6 @@
mFileUpdater = new FileUpdater(context);
mBatterySavingStats = batterySavingStats;
- // TODO(79580230): remove plugin code and maybe screen on/off listeners?
- // Initialize plugins.
- mPlugins = new Plugin[0];
PowerManager.invalidatePowerSaveModeCaches();
}
@@ -300,12 +284,6 @@
msg.arg1 == ARG_SEND_BROADCAST,
msg.arg2);
break;
-
- case MSG_SYSTEM_READY:
- for (Plugin p : mPlugins) {
- p.onSystemReady(BatterySaverController.this);
- }
- break;
}
}
}
@@ -479,10 +457,6 @@
mFileUpdater.writeFiles(fileValues);
}
- for (Plugin p : mPlugins) {
- p.onBatterySaverChanged(this);
- }
-
if (sendBroadcast) {
if (DEBUG) {
diff --git a/services/core/java/com/android/server/powerstats/OWNERS b/services/core/java/com/android/server/powerstats/OWNERS
new file mode 100644
index 0000000..d68066b
--- /dev/null
+++ b/services/core/java/com/android/server/powerstats/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/power/OWNERS
diff --git a/services/core/java/com/android/server/role/RoleManagerService.java b/services/core/java/com/android/server/role/RoleManagerService.java
index eb15c80..caa275d 100644
--- a/services/core/java/com/android/server/role/RoleManagerService.java
+++ b/services/core/java/com/android/server/role/RoleManagerService.java
@@ -34,7 +34,6 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
-import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.PackageManagerInternal;
import android.content.pm.Signature;
@@ -754,18 +753,6 @@
dumpOutputStream.flush();
}
-
- private int getUidForPackage(String packageName) {
- final long ident = Binder.clearCallingIdentity();
- try {
- return getContext().getPackageManager().getApplicationInfo(packageName,
- PackageManager.MATCH_ANY_USER).uid;
- } catch (NameNotFoundException nnfe) {
- return -1;
- } finally {
- Binder.restoreCallingIdentity(ident);
- }
- }
}
private class Internal extends RoleManagerInternal {
diff --git a/services/core/java/com/android/server/rollback/OWNERS b/services/core/java/com/android/server/rollback/OWNERS
new file mode 100644
index 0000000..7feb85f
--- /dev/null
+++ b/services/core/java/com/android/server/rollback/OWNERS
@@ -0,0 +1 @@
[email protected]
diff --git a/services/core/java/com/android/server/slice/OWNERS b/services/core/java/com/android/server/slice/OWNERS
new file mode 100644
index 0000000..3d0859f
--- /dev/null
+++ b/services/core/java/com/android/server/slice/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/app/slice/OWNERS
diff --git a/services/core/java/com/android/server/statusbar/OWNERS b/services/core/java/com/android/server/statusbar/OWNERS
new file mode 100644
index 0000000..2e96c97
--- /dev/null
+++ b/services/core/java/com/android/server/statusbar/OWNERS
@@ -0,0 +1 @@
+include /packages/SystemUI/OWNERS
diff --git a/services/core/java/com/android/server/storage/OWNERS b/services/core/java/com/android/server/storage/OWNERS
new file mode 100644
index 0000000..6f9dbea
--- /dev/null
+++ b/services/core/java/com/android/server/storage/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/os/storage/OWNERS
diff --git a/services/core/java/com/android/server/textclassifier/OWNERS b/services/core/java/com/android/server/textclassifier/OWNERS
new file mode 100644
index 0000000..46b3cb8
--- /dev/null
+++ b/services/core/java/com/android/server/textclassifier/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/service/textclassifier/OWNERS
diff --git a/services/core/java/com/android/server/timedetector/OWNERS b/services/core/java/com/android/server/timedetector/OWNERS
new file mode 100644
index 0000000..09447a97
--- /dev/null
+++ b/services/core/java/com/android/server/timedetector/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/app/timezone/OWNERS
diff --git a/services/core/java/com/android/server/timezone/OWNERS b/services/core/java/com/android/server/timezone/OWNERS
new file mode 100644
index 0000000..09447a97
--- /dev/null
+++ b/services/core/java/com/android/server/timezone/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/app/timezone/OWNERS
diff --git a/services/core/java/com/android/server/timezonedetector/OWNERS b/services/core/java/com/android/server/timezonedetector/OWNERS
new file mode 100644
index 0000000..09447a97
--- /dev/null
+++ b/services/core/java/com/android/server/timezonedetector/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/app/timezone/OWNERS
diff --git a/services/core/java/com/android/server/trust/OWNERS b/services/core/java/com/android/server/trust/OWNERS
new file mode 100644
index 0000000..b039c4b
--- /dev/null
+++ b/services/core/java/com/android/server/trust/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/app/trust/OWNERS
diff --git a/services/core/java/com/android/server/tv/OWNERS b/services/core/java/com/android/server/tv/OWNERS
new file mode 100644
index 0000000..305027c
--- /dev/null
+++ b/services/core/java/com/android/server/tv/OWNERS
@@ -0,0 +1 @@
+include /media/java/android/media/tv/OWNERS
diff --git a/services/core/java/com/android/server/uri/OWNERS b/services/core/java/com/android/server/uri/OWNERS
new file mode 100644
index 0000000..cdc07ed
--- /dev/null
+++ b/services/core/java/com/android/server/uri/OWNERS
@@ -0,0 +1,3 @@
[email protected]
[email protected]
[email protected]
diff --git a/services/core/java/com/android/server/vibrator/OWNERS b/services/core/java/com/android/server/vibrator/OWNERS
new file mode 100644
index 0000000..7e7335d
--- /dev/null
+++ b/services/core/java/com/android/server/vibrator/OWNERS
@@ -0,0 +1 @@
[email protected]
diff --git a/services/core/java/com/android/server/wallpaper/OWNERS b/services/core/java/com/android/server/wallpaper/OWNERS
new file mode 100644
index 0000000..8ff0f74
--- /dev/null
+++ b/services/core/java/com/android/server/wallpaper/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/service/wallpaper/OWNERS
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index e88f8e3..0678a5e 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -2298,10 +2298,6 @@
.setSubtype(getConfiguration().orientation)
.addTaggedData(MetricsEvent.FIELD_DISPLAY_ID, getDisplayId()));
}
-
- if (mPinnedStackControllerLocked != null) {
- mPinnedStackControllerLocked.onDisplayInfoChanged(getDisplayInfo());
- }
}
/**
diff --git a/services/core/java/com/android/server/wm/PinnedStackController.java b/services/core/java/com/android/server/wm/PinnedStackController.java
index fd42b24..8fe2481 100644
--- a/services/core/java/com/android/server/wm/PinnedStackController.java
+++ b/services/core/java/com/android/server/wm/PinnedStackController.java
@@ -127,7 +127,6 @@
try {
listener.asBinder().linkToDeath(mPinnedStackListenerDeathHandler, 0);
mPinnedStackListener = listener;
- notifyDisplayInfoChanged(mDisplayInfo);
notifyImeVisibilityChanged(mIsImeShowing, mImeHeight);
notifyMovementBoundsChanged(false /* fromImeAdjustment */);
notifyActionsChanged(mActions);
@@ -171,23 +170,6 @@
}
}
- private void setDisplayInfo(DisplayInfo displayInfo) {
- mDisplayInfo.copyFrom(displayInfo);
- notifyDisplayInfoChanged(mDisplayInfo);
- }
-
- /**
- * In the case where the display rotation is changed but there is no stack, we can't depend on
- * onTaskStackBoundsChanged() to be called. But we still should update our known display info
- * with the new state so that we can update SystemUI.
- */
- void onDisplayInfoChanged(DisplayInfo displayInfo) {
- synchronized (mService.mGlobalLock) {
- setDisplayInfo(displayInfo);
- notifyMovementBoundsChanged(false /* fromImeAdjustment */);
- }
- }
-
/**
* Sets the Ime state and height.
*/
@@ -288,18 +270,6 @@
}
}
- /**
- * Notifies listeners that the PIP animation is about to happen.
- */
- private void notifyDisplayInfoChanged(DisplayInfo displayInfo) {
- if (mPinnedStackListener == null) return;
- try {
- mPinnedStackListener.onDisplayInfoChanged(displayInfo);
- } catch (RemoteException e) {
- Slog.e(TAG_WM, "Error delivering DisplayInfo changed event.", e);
- }
- }
-
void dump(String prefix, PrintWriter pw) {
pw.println(prefix + "PinnedStackController");
pw.println(prefix + " mIsImeShowing=" + mIsImeShowing);
diff --git a/services/core/java/com/android/server/wm/TaskSnapshotController.java b/services/core/java/com/android/server/wm/TaskSnapshotController.java
index 616a789..b2f3062 100644
--- a/services/core/java/com/android/server/wm/TaskSnapshotController.java
+++ b/services/core/java/com/android/server/wm/TaskSnapshotController.java
@@ -369,7 +369,8 @@
SurfaceControl[] excludeLayers;
final WindowState imeWindow = task.getDisplayContent().mInputMethodWindow;
// Exclude IME window snapshot when IME isn't proper to attach to app.
- if (imeWindow != null && !task.getDisplayContent().isImeAttachedToApp()) {
+ if (imeWindow != null && imeWindow.getSurfaceControl() != null
+ && !task.getDisplayContent().isImeAttachedToApp()) {
excludeLayers = new SurfaceControl[1];
excludeLayers[0] = imeWindow.getSurfaceControl();
} else {
diff --git a/services/core/jni/OWNERS b/services/core/jni/OWNERS
index 6f74885..7fc5565 100644
--- a/services/core/jni/OWNERS
+++ b/services/core/jni/OWNERS
@@ -12,3 +12,18 @@
per-file com_android_server_HardwarePropertiesManagerService.cpp = [email protected], [email protected]
per-file com_android_server_power_PowerManagerService.* = [email protected], [email protected]
+per-file Android.bp = file:platform/build/soong:/OWNERS
+per-file com_android_server_Usb* = file:/services/usb/OWNERS
+per-file com_android_server_Vibrator* = file:/services/core/java/com/android/server/vibrator/OWNERS
+per-file com_android_server_hdmi_* = file:/core/java/android/hardware/hdmi/OWNERS
+per-file com_android_server_input_* = file:/core/java/android/hardware/input/OWNERS
+per-file com_android_server_lights_* = file:/services/core/java/com/android/server/lights/OWNERS
+per-file com_android_server_location_* = file:/location/java/android/location/OWNERS
+per-file com_android_server_locksettings_* = file:/services/core/java/com/android/server/locksettings/OWNERS
+per-file com_android_server_net_* = file:/services/core/java/com/android/server/net/OWNERS
+per-file com_android_server_pm_* = file:/services/core/java/com/android/server/pm/OWNERS
+per-file com_android_server_power_* = file:/services/core/java/com/android/server/power/OWNERS
+per-file com_android_server_se_* = file:/core/java/android/se/OWNERS
+per-file com_android_server_security_* = file:/core/java/android/security/OWNERS
+per-file com_android_server_tv_* = file:/media/java/android/media/tv/OWNERS
+per-file com_android_server_vibrator_* = file:/services/core/java/com/android/server/vibrator/OWNERS
diff --git a/services/core/jni/com_android_server_input_InputManagerService.cpp b/services/core/jni/com_android_server_input_InputManagerService.cpp
index 13450be..404b182 100644
--- a/services/core/jni/com_android_server_input_InputManagerService.cpp
+++ b/services/core/jni/com_android_server_input_InputManagerService.cpp
@@ -149,6 +149,14 @@
jmethodID getAffineTransform;
} gTouchCalibrationClassInfo;
+static struct {
+ jclass clazz;
+ jmethodID constructor;
+ jmethodID keyAt;
+ jmethodID valueAt;
+ jmethodID size;
+} gSparseArrayClassInfo;
+
// --- Global functions ---
template<typename T>
@@ -1705,19 +1713,73 @@
patternObj, nullptr));
jint* amplitudes = static_cast<jint*>(env->GetPrimitiveArrayCritical(amplitudesObj, nullptr));
- std::vector<VibrationElement> elements(patternSize);
+ VibrationSequence sequence(patternSize);
+ std::vector<int32_t> vibrators = im->getInputManager()->getReader()->getVibratorIds(deviceId);
for (size_t i = 0; i < patternSize; i++) {
// VibrationEffect.validate guarantees duration > 0.
std::chrono::milliseconds duration(patternMillis[i]);
- elements[i].duration = std::min(duration, MAX_VIBRATE_PATTERN_DELAY_MILLIS);
- // TODO: (b/161629089) apply channel specific amplitudes from development API.
- elements[i].channels = {static_cast<uint8_t>(amplitudes[i]),
- static_cast<uint8_t>(amplitudes[i])};
+ VibrationElement element(CHANNEL_SIZE);
+ element.duration = std::min(duration, MAX_VIBRATE_PATTERN_DELAY_MILLIS);
+ // Vibrate on both channels
+ for (int32_t channel = 0; channel < vibrators.size(); channel++) {
+ element.addChannel(vibrators[channel], static_cast<uint8_t>(amplitudes[i]));
+ }
+ sequence.addElement(element);
}
env->ReleasePrimitiveArrayCritical(patternObj, patternMillis, JNI_ABORT);
env->ReleasePrimitiveArrayCritical(amplitudesObj, amplitudes, JNI_ABORT);
- im->getInputManager()->getReader()->vibrate(deviceId, elements, repeat, token);
+ im->getInputManager()->getReader()->vibrate(deviceId, sequence, repeat, token);
+}
+
+static void nativeVibrateCombined(JNIEnv* env, jclass /* clazz */, jlong ptr, jint deviceId,
+ jlongArray patternObj, jobject amplitudesObj, jint repeat,
+ jint token) {
+ NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr);
+
+ size_t patternSize = env->GetArrayLength(patternObj);
+
+ if (patternSize > MAX_VIBRATE_PATTERN_SIZE) {
+ ALOGI("Skipped requested vibration because the pattern size is %zu "
+ "which is more than the maximum supported size of %d.",
+ patternSize, MAX_VIBRATE_PATTERN_SIZE);
+ return; // limit to reasonable size
+ }
+ const jlong* patternMillis = env->GetLongArrayElements(patternObj, nullptr);
+
+ std::array<jint*, CHANNEL_SIZE> amplitudesArray;
+ std::array<jint, CHANNEL_SIZE> vibratorIdArray;
+ jint amplSize = env->CallIntMethod(amplitudesObj, gSparseArrayClassInfo.size);
+ if (amplSize > CHANNEL_SIZE) {
+ ALOGE("Can not fit into input device vibration element.");
+ return;
+ }
+
+ for (int i = 0; i < amplSize; i++) {
+ vibratorIdArray[i] = env->CallIntMethod(amplitudesObj, gSparseArrayClassInfo.keyAt, i);
+ jintArray arr = static_cast<jintArray>(
+ env->CallObjectMethod(amplitudesObj, gSparseArrayClassInfo.valueAt, i));
+ amplitudesArray[i] = env->GetIntArrayElements(arr, nullptr);
+ if (env->GetArrayLength(arr) != patternSize) {
+ ALOGE("Amplitude length not equal to pattern length!");
+ return;
+ }
+ }
+
+ VibrationSequence sequence(patternSize);
+ for (size_t i = 0; i < patternSize; i++) {
+ VibrationElement element(CHANNEL_SIZE);
+ // VibrationEffect.validate guarantees duration > 0.
+ std::chrono::milliseconds duration(patternMillis[i]);
+ element.duration = std::min(duration, MAX_VIBRATE_PATTERN_DELAY_MILLIS);
+ for (int32_t channel = 0; channel < CHANNEL_SIZE; channel++) {
+ element.addChannel(vibratorIdArray[channel],
+ static_cast<uint8_t>(amplitudesArray[channel][i]));
+ }
+ sequence.addElement(element);
+ }
+
+ im->getInputManager()->getReader()->vibrate(deviceId, sequence, repeat, token);
}
static void nativeCancelVibrate(JNIEnv* /* env */,
@@ -1727,6 +1789,23 @@
im->getInputManager()->getReader()->cancelVibrate(deviceId, token);
}
+static bool nativeIsVibrating(JNIEnv* /* env */, jclass /* clazz */, jlong ptr, jint deviceId) {
+ NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr);
+
+ return im->getInputManager()->getReader()->isVibrating(deviceId);
+}
+
+static jintArray nativeGetVibratorIds(JNIEnv* env, jclass clazz, jlong ptr, jint deviceId) {
+ NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr);
+ std::vector<int32_t> vibrators = im->getInputManager()->getReader()->getVibratorIds(deviceId);
+
+ jintArray vibIdArray = env->NewIntArray(vibrators.size());
+ if (vibIdArray != nullptr) {
+ env->SetIntArrayRegion(vibIdArray, 0, vibrators.size(), vibrators.data());
+ }
+ return vibIdArray;
+}
+
static void nativeReloadKeyboardLayouts(JNIEnv* /* env */,
jclass /* clazz */, jlong ptr) {
NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr);
@@ -1872,7 +1951,11 @@
{"nativeSetInteractive", "(JZ)V", (void*)nativeSetInteractive},
{"nativeReloadCalibration", "(J)V", (void*)nativeReloadCalibration},
{"nativeVibrate", "(JI[J[III)V", (void*)nativeVibrate},
+ {"nativeVibrateCombined", "(JI[JLandroid/util/SparseArray;II)V",
+ (void*)nativeVibrateCombined},
{"nativeCancelVibrate", "(JII)V", (void*)nativeCancelVibrate},
+ {"nativeIsVibrating", "(JI)Z", (void*)nativeIsVibrating},
+ {"nativeGetVibratorIds", "(JI)[I", (void*)nativeGetVibratorIds},
{"nativeReloadKeyboardLayouts", "(J)V", (void*)nativeReloadKeyboardLayouts},
{"nativeReloadDeviceAliases", "(J)V", (void*)nativeReloadDeviceAliases},
{"nativeDump", "(J)Ljava/lang/String;", (void*)nativeDump},
@@ -2048,6 +2131,15 @@
GET_METHOD_ID(gTouchCalibrationClassInfo.getAffineTransform, gTouchCalibrationClassInfo.clazz,
"getAffineTransform", "()[F");
+ // SparseArray
+ FIND_CLASS(gSparseArrayClassInfo.clazz, "android/util/SparseArray");
+ gSparseArrayClassInfo.clazz = jclass(env->NewGlobalRef(gSparseArrayClassInfo.clazz));
+ GET_METHOD_ID(gSparseArrayClassInfo.constructor, gSparseArrayClassInfo.clazz, "<init>", "()V");
+ GET_METHOD_ID(gSparseArrayClassInfo.keyAt, gSparseArrayClassInfo.clazz, "keyAt", "(I)I");
+ GET_METHOD_ID(gSparseArrayClassInfo.valueAt, gSparseArrayClassInfo.clazz, "valueAt",
+ "(I)Ljava/lang/Object;");
+ GET_METHOD_ID(gSparseArrayClassInfo.size, gSparseArrayClassInfo.clazz, "size", "()I");
+
return 0;
}
diff --git a/services/core/jni/gnss/OWNERS b/services/core/jni/gnss/OWNERS
new file mode 100644
index 0000000..5ac60284
--- /dev/null
+++ b/services/core/jni/gnss/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/location/OWNERS
diff --git a/services/core/xsd/platform-compat-schema/OWNERS b/services/core/xsd/platform-compat-schema/OWNERS
new file mode 100644
index 0000000..f8c3520
--- /dev/null
+++ b/services/core/xsd/platform-compat-schema/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/compat/OWNERS
diff --git a/services/devicepolicy/OWNERS b/services/devicepolicy/OWNERS
new file mode 100644
index 0000000..e95633a
--- /dev/null
+++ b/services/devicepolicy/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/app/admin/OWNERS
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/BaseIDevicePolicyManager.java b/services/devicepolicy/java/com/android/server/devicepolicy/BaseIDevicePolicyManager.java
index ce61d50..22976c30 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/BaseIDevicePolicyManager.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/BaseIDevicePolicyManager.java
@@ -22,6 +22,8 @@
import com.android.server.SystemService;
+import java.util.List;
+
/**
* Defines the required interface for IDevicePolicyManager implemenation.
*
@@ -101,4 +103,9 @@
public boolean canProfileOwnerResetPasswordWhenLocked(int userId) {
return false;
}
+
+ public List<String> getKeyPairGrants(String callerPackage, String alias) {
+ // STOPSHIP: implement delegation code in ArcDevicePolicyManagerWrapperService & nuke this.
+ return null;
+ }
}
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index edcf9e8..6d2cb9c 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -2328,7 +2328,8 @@
+ admin.info.getTagForPolicy(reqPolicy));
} else {
throw new SecurityException("No active admin owned by uid "
- + callingUid + " for policy #" + reqPolicy);
+ + callingUid + " for policy #" + reqPolicy + (permission == null ? ""
+ : ", which doesn't have " + permission));
}
}
@@ -2388,6 +2389,7 @@
* If not provided, iterate over all of the active admins in the DevicePolicyData for that user
* and return the one with the uid specified as parameter, and has the policy specified.
*/
+ @Nullable
private ActiveAdmin getActiveAdminWithPolicyForUidLocked(ComponentName who, int reqPolicy,
int uid) {
ensureLocked();
@@ -5190,6 +5192,44 @@
return false;
}
+ @Override
+ public List<String> getKeyPairGrants(String callerPackage, String alias) {
+ final CallerIdentity caller = getCallerIdentity(callerPackage);
+ Preconditions.checkCallAuthorization(canManageCertificates(caller));
+
+ return mInjector.binderWithCleanCallingIdentity(() -> {
+ try (KeyChainConnection keyChainConnection =
+ KeyChain.bindAsUser(mContext, caller.getUserHandle())) {
+ final List<String> result = new ArrayList<>();
+ final int[] granteeUids = keyChainConnection.getService().getGrants(alias);
+ final PackageManager pm = mInjector.getPackageManager(caller.getUserId());
+
+ // TODO: Return Set<Set<String>> when AIDL supports it: b/136048684
+ // Public API returns a set of sets, where each internal set contains all package
+ // names corresponding to the same UID. For now a set of sets is marshalled as a
+ // null-separated list.
+ for (final int uid : granteeUids) {
+ final String[] packages = pm.getPackagesForUid(uid);
+ if (packages == null) {
+ Slog.wtf(LOG_TAG, "No packages found for uid " + uid);
+ continue;
+ }
+ if (!result.isEmpty()) {
+ result.add(null);
+ }
+ result.addAll(Arrays.asList(packages));
+ }
+ return result;
+ } catch (RemoteException e) {
+ Log.e(LOG_TAG, "Querying keypair grants", e);
+ } catch (InterruptedException e) {
+ Log.w(LOG_TAG, "Interrupted while querying keypair grants", e);
+ Thread.currentThread().interrupt();
+ }
+ return Collections.emptyList();
+ });
+ }
+
/**
* Enforce one the following conditions are met:
* (1) The device has a Device Owner, and one of the following holds:
@@ -6096,10 +6136,14 @@
final ActiveAdmin admin;
synchronized (getLockObject()) {
- admin = getActiveAdminForCallerLocked(null, DeviceAdminInfo.USES_POLICY_WIPE_DATA);
+ admin = getActiveAdminWithPolicyForUidLocked(/* who= */ null,
+ DeviceAdminInfo.USES_POLICY_WIPE_DATA, caller.getUid());
}
- Preconditions.checkCallAuthorization(admin != null,
- "No active admin for user %d", caller.getUserId());
+
+ Preconditions.checkCallAuthorization(
+ (admin != null) || hasCallingOrSelfPermission(permission.MASTER_CLEAR),
+ "No active admin for user %d and caller %d does not hold MASTER_CLEAR permission",
+ caller.getUserId(), caller.getUid());
if (TextUtils.isEmpty(wipeReasonForUser)) {
if (calledByProfileOwnerOnOrgOwnedDevice && !calledOnParentInstance) {
@@ -6110,7 +6154,10 @@
}
}
- int userId = admin.getUserHandle().getIdentifier();
+ int userId = admin != null ? admin.getUserHandle().getIdentifier()
+ : caller.getUserId();
+ Slog.i(LOG_TAG, String.format("wipeDataWithReason(%s): admin=%s, user=%d",
+ wipeReasonForUser, admin, userId));
if (calledByProfileOwnerOnOrgOwnedDevice) {
// When wipeData is called on the parent instance, it implies wiping the entire device.
if (calledOnParentInstance) {
@@ -6133,20 +6180,35 @@
});
}
}
-
- DevicePolicyEventLogger
+ DevicePolicyEventLogger event = DevicePolicyEventLogger
.createEvent(DevicePolicyEnums.WIPE_DATA_WITH_REASON)
- .setAdmin(admin.info.getComponent())
.setInt(flags)
.setStrings(calledOnParentInstance ? CALLED_FROM_PARENT : NOT_CALLED_FROM_PARENT)
- .write();
+ ;
+ final String adminName;
+ final ComponentName adminComp;
+ if (admin != null) {
+ adminComp = admin.info.getComponent();
+ adminName = adminComp.flattenToShortString();
+ event.setAdmin(adminComp);
+ } else {
+ adminComp = null;
+ adminName = mInjector.getPackageManager().getPackagesForUid(caller.getUid())[0];
+ Slog.i(LOG_TAG, "Logging wipeData() event admin as " + adminName);
+ event.setAdmin(adminName);
+ if (mInjector.userManagerIsHeadlessSystemUserMode()) {
+ // On headless system user mode, the call is meant to factory reset the whole
+ // device, otherwise the caller could simply remove the current user.
+ userId = UserHandle.USER_SYSTEM;
+ }
+ }
+ event.write();
+
String internalReason = String.format(
"DevicePolicyManager.wipeDataWithReason() from %s, organization-owned? %s",
- admin.info.getComponent().flattenToShortString(),
- calledByProfileOwnerOnOrgOwnedDevice);
+ adminName, calledByProfileOwnerOnOrgOwnedDevice);
- wipeDataNoLock(
- admin.info.getComponent(), flags, internalReason, wipeReasonForUser, userId);
+ wipeDataNoLock(adminComp, flags, internalReason, wipeReasonForUser, userId);
}
private void wipeDataNoLock(ComponentName admin, int flags, String internalReason,
diff --git a/services/incremental/OWNERS b/services/incremental/OWNERS
new file mode 100644
index 0000000..d825dfd
--- /dev/null
+++ b/services/incremental/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/pm/OWNERS
diff --git a/services/people/OWNERS b/services/people/OWNERS
new file mode 100644
index 0000000..7ac9b73
--- /dev/null
+++ b/services/people/OWNERS
@@ -0,0 +1,2 @@
[email protected]
[email protected]
diff --git a/services/print/OWNERS b/services/print/OWNERS
new file mode 100644
index 0000000..2c7b881
--- /dev/null
+++ b/services/print/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/print/OWNERS
diff --git a/services/restrictions/OWNERS b/services/restrictions/OWNERS
new file mode 100644
index 0000000..95e614c8
--- /dev/null
+++ b/services/restrictions/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/service/restrictions/OWNERS
diff --git a/services/robotests/backup/OWNERS b/services/robotests/backup/OWNERS
new file mode 100644
index 0000000..d99779e
--- /dev/null
+++ b/services/robotests/backup/OWNERS
@@ -0,0 +1 @@
+include /services/backup/OWNERS
diff --git a/services/robotests/src/com/android/server/backup/OWNERS b/services/robotests/src/com/android/server/backup/OWNERS
new file mode 100644
index 0000000..d99779e
--- /dev/null
+++ b/services/robotests/src/com/android/server/backup/OWNERS
@@ -0,0 +1 @@
+include /services/backup/OWNERS
diff --git a/services/robotests/src/com/android/server/pm/OWNERS b/services/robotests/src/com/android/server/pm/OWNERS
new file mode 100644
index 0000000..d825dfd
--- /dev/null
+++ b/services/robotests/src/com/android/server/pm/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/pm/OWNERS
diff --git a/services/startop/OWNERS b/services/startop/OWNERS
new file mode 100644
index 0000000..bd3d829
--- /dev/null
+++ b/services/startop/OWNERS
@@ -0,0 +1 @@
+include /startop/OWNERS
diff --git a/services/tests/PackageManager/OWNERS b/services/tests/PackageManager/OWNERS
new file mode 100644
index 0000000..d825dfd
--- /dev/null
+++ b/services/tests/PackageManager/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/pm/OWNERS
diff --git a/services/tests/PackageManagerComponentOverrideTests/OWNERS b/services/tests/PackageManagerComponentOverrideTests/OWNERS
new file mode 100644
index 0000000..d825dfd
--- /dev/null
+++ b/services/tests/PackageManagerComponentOverrideTests/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/pm/OWNERS
diff --git a/services/tests/mockingservicestests/AndroidManifest.xml b/services/tests/mockingservicestests/AndroidManifest.xml
index 182fe9a..fbde1d2 100644
--- a/services/tests/mockingservicestests/AndroidManifest.xml
+++ b/services/tests/mockingservicestests/AndroidManifest.xml
@@ -27,6 +27,9 @@
<uses-permission android:name="android.permission.MANAGE_APPOPS"/>
<uses-permission android:name="android.permission.MONITOR_DEVICE_CONFIG_ACCESS"/>
+ <!-- needed by MasterClearReceiverTest to display a system dialog -->
+ <uses-permission android:name="android.permission.INTERNAL_SYSTEM_WINDOW"/>
+
<application android:testOnly="true"
android:debuggable="true">
<uses-library android:name="android.test.runner" />
diff --git a/services/tests/mockingservicestests/assets/AppOpsUpgradeTest/OWNERS b/services/tests/mockingservicestests/assets/AppOpsUpgradeTest/OWNERS
new file mode 100644
index 0000000..999ea0e
--- /dev/null
+++ b/services/tests/mockingservicestests/assets/AppOpsUpgradeTest/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/permission/OWNERS
diff --git a/services/tests/mockingservicestests/src/com/android/server/MasterClearReceiverTest.java b/services/tests/mockingservicestests/src/com/android/server/MasterClearReceiverTest.java
new file mode 100644
index 0000000..f01120e
--- /dev/null
+++ b/services/tests/mockingservicestests/src/com/android/server/MasterClearReceiverTest.java
@@ -0,0 +1,210 @@
+/*
+ * Copyright (C) 2020 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;
+
+import static com.android.dx.mockito.inline.extended.ExtendedMockito.doAnswer;
+import static com.android.dx.mockito.inline.extended.ExtendedMockito.mockitoSession;
+import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify;
+
+import static com.google.common.truth.Truth.assertWithMessage;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyBoolean;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.same;
+import static org.mockito.Mockito.never;
+
+import android.content.Context;
+import android.content.ContextWrapper;
+import android.content.Intent;
+import android.os.Looper;
+import android.os.RecoverySystem;
+import android.os.storage.StorageManager;
+import android.platform.test.annotations.Presubmit;
+import android.util.Log;
+import android.view.WindowManager;
+
+import androidx.test.InstrumentationRegistry;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoSession;
+import org.mockito.quality.Strictness;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Run it as {@code FrameworksMockingServicesTests:MasterClearReceiverTest}.
+ */
+@Presubmit
+public final class MasterClearReceiverTest {
+
+ private static final String TAG = MasterClearReceiverTest.class.getSimpleName();
+
+ private MockitoSession mSession;
+
+ // Cannot @Mock context because MasterClearReceiver shows an AlertDialog, which relies
+ // on resources - we'd need to mock them as well.
+ private final Context mContext = new ContextWrapper(
+ InstrumentationRegistry.getInstrumentation().getTargetContext()) {
+
+ @Override
+ public Object getSystemService(String name) {
+ Log.v(TAG, "getSystemService(): " + name);
+ return name.equals(Context.STORAGE_SERVICE) ? mSm : super.getSystemService(name);
+ }
+ };
+
+ private final MasterClearReceiver mReceiver = new MasterClearReceiver();
+
+ // Used to make sure that wipeAdoptableDisks() is called before rebootWipeUserData()
+ private boolean mWipeExternalDataCalled;
+
+ // Uset to block test until rebootWipeUserData() is called, as it might be asynchronous called
+ // in a different thread
+ private final CountDownLatch mRebootWipeUserDataLatch = new CountDownLatch(1);
+
+ @Mock
+ private StorageManager mSm;
+
+ @Mock
+ private WindowManager mWm;
+
+ @Before
+ public void startSession() {
+ mSession = mockitoSession()
+ .initMocks(this)
+ .mockStatic(RecoverySystem.class)
+ .strictness(Strictness.LENIENT)
+ .startMocking();
+ }
+
+ @After
+ public void finishSession() {
+ if (mSession == null) {
+ Log.w(TAG, "finishSession(): no session");
+ return;
+ }
+ mSession.finishMocking();
+ }
+
+ @Test
+ public void testNoExtras() throws Exception {
+ expectNoWipeExternalData();
+ expectRebootWipeUserData();
+
+ Intent intent = new Intent(Intent.ACTION_FACTORY_RESET);
+ mReceiver.onReceive(mContext, intent);
+
+ verifyRebootWipeUserData();
+ verifyNoWipeExternalData();
+ }
+
+ @Test
+ public void testWipeExternalDirectory() throws Exception {
+ expectWipeExternalData();
+ expectRebootWipeUserData();
+
+ Intent intent = new Intent(Intent.ACTION_FACTORY_RESET);
+ intent.putExtra(Intent.EXTRA_WIPE_EXTERNAL_STORAGE, true);
+ mReceiver.onReceive(mContext, intent);
+
+ verifyRebootWipeUserData();
+ verifyWipeExternalData();
+ }
+
+ @Test
+ public void testAllExtras() throws Exception {
+ expectWipeExternalData();
+ expectRebootWipeUserData();
+
+ Intent intent = new Intent(Intent.ACTION_FACTORY_RESET);
+ intent.putExtra(Intent.EXTRA_WIPE_EXTERNAL_STORAGE, true);
+ intent.putExtra("shutdown", true);
+ intent.putExtra(Intent.EXTRA_REASON, "Self destruct");
+ intent.putExtra(Intent.EXTRA_FORCE_FACTORY_RESET, true);
+ intent.putExtra(Intent.EXTRA_WIPE_ESIMS, true);
+ mReceiver.onReceive(mContext, intent);
+
+ verifyRebootWipeUserData(/* shutdown= */ true, /* reason= */ "Self destruct",
+ /* force= */ true, /* wipeEuicc= */ true);
+ verifyWipeExternalData();
+ }
+
+
+ private void expectNoWipeExternalData() {
+ // This is a trick to simplify how the order of methods are called: as wipeAdoptableDisks()
+ // should be called before rebootWipeUserData(), expectRebootWipeUserData() throws an
+ // exception if it's not called, so this method "emulates" a call when it's not neeeded.
+ //
+ // A more robust solution would be using internal counters for expected and actual mocked
+ // calls, so the expectXXX() methods would increment expected counter and the Answer
+ // implementations would increment the actual counter and check if they match, but that
+ // would be an overkill (and make the test logic more complicated).
+ mWipeExternalDataCalled = true;
+ }
+
+ private void expectRebootWipeUserData() {
+ doAnswer((inv) -> {
+ Log.i(TAG, inv.toString());
+ if (!mWipeExternalDataCalled) {
+ String error = "rebootWipeUserData() called before wipeAdoptableDisks()";
+ Log.e(TAG, error);
+ throw new IllegalStateException(error);
+ }
+ mRebootWipeUserDataLatch.countDown();
+ return null;
+ }).when(() -> RecoverySystem
+ .rebootWipeUserData(any(), anyBoolean(), any(), anyBoolean(), anyBoolean()));
+ }
+
+ private void expectWipeExternalData() {
+ Looper.prepare(); // needed by Dialog
+
+ doAnswer((inv) -> {
+ Log.i(TAG, inv.toString());
+ mWipeExternalDataCalled = true;
+ return null;
+ }).when(mSm).wipeAdoptableDisks();
+ }
+
+ private void verifyRebootWipeUserData() throws Exception {
+ verifyRebootWipeUserData(/* shutdown= */ false, /* reason= */ null, /* force= */ false,
+ /* wipeEuicc= */ false);
+
+ }
+
+ private void verifyRebootWipeUserData(boolean shutdown, String reason, boolean force,
+ boolean wipeEuicc) throws Exception {
+ boolean called = mRebootWipeUserDataLatch.await(5, TimeUnit.SECONDS);
+ assertWithMessage("rebootWipeUserData not called in 5s").that(called).isTrue();
+
+ verify(()-> RecoverySystem.rebootWipeUserData(same(mContext), eq(shutdown), eq(reason),
+ eq(force), eq(wipeEuicc)));
+ }
+
+ private void verifyWipeExternalData() {
+ verify(mSm).wipeAdoptableDisks();
+ }
+
+ private void verifyNoWipeExternalData() {
+ verify(mSm, never()).wipeAdoptableDisks();
+ }
+}
diff --git a/services/tests/mockingservicestests/src/com/android/server/OWNERS b/services/tests/mockingservicestests/src/com/android/server/OWNERS
new file mode 100644
index 0000000..e779e21
--- /dev/null
+++ b/services/tests/mockingservicestests/src/com/android/server/OWNERS
@@ -0,0 +1 @@
+per-file *Alarm* = file:/apex/jobscheduler/OWNERS
diff --git a/services/tests/mockingservicestests/src/com/android/server/alarm/OWNERS b/services/tests/mockingservicestests/src/com/android/server/alarm/OWNERS
new file mode 100644
index 0000000..6f207fb1
--- /dev/null
+++ b/services/tests/mockingservicestests/src/com/android/server/alarm/OWNERS
@@ -0,0 +1 @@
+include /apex/jobscheduler/OWNERS
diff --git a/services/tests/mockingservicestests/src/com/android/server/am/OWNERS b/services/tests/mockingservicestests/src/com/android/server/am/OWNERS
new file mode 100644
index 0000000..72c0a9e
--- /dev/null
+++ b/services/tests/mockingservicestests/src/com/android/server/am/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/am/OWNERS
diff --git a/services/tests/mockingservicestests/src/com/android/server/appop/OWNERS b/services/tests/mockingservicestests/src/com/android/server/appop/OWNERS
new file mode 100644
index 0000000..999ea0e
--- /dev/null
+++ b/services/tests/mockingservicestests/src/com/android/server/appop/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/permission/OWNERS
diff --git a/services/tests/mockingservicestests/src/com/android/server/blob/OWNERS b/services/tests/mockingservicestests/src/com/android/server/blob/OWNERS
new file mode 100644
index 0000000..65bb6b8
--- /dev/null
+++ b/services/tests/mockingservicestests/src/com/android/server/blob/OWNERS
@@ -0,0 +1 @@
+include /apex/blobstore/OWNERS
diff --git a/services/tests/mockingservicestests/src/com/android/server/display/OWNERS b/services/tests/mockingservicestests/src/com/android/server/display/OWNERS
new file mode 100644
index 0000000..6ce1ee4
--- /dev/null
+++ b/services/tests/mockingservicestests/src/com/android/server/display/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/display/OWNERS
diff --git a/services/tests/mockingservicestests/src/com/android/server/job/OWNERS b/services/tests/mockingservicestests/src/com/android/server/job/OWNERS
new file mode 100644
index 0000000..6f207fb1
--- /dev/null
+++ b/services/tests/mockingservicestests/src/com/android/server/job/OWNERS
@@ -0,0 +1 @@
+include /apex/jobscheduler/OWNERS
diff --git a/services/tests/mockingservicestests/src/com/android/server/power/OWNERS b/services/tests/mockingservicestests/src/com/android/server/power/OWNERS
new file mode 100644
index 0000000..d68066b
--- /dev/null
+++ b/services/tests/mockingservicestests/src/com/android/server/power/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/power/OWNERS
diff --git a/services/tests/mockingservicestests/src/com/android/server/usage/OWNERS b/services/tests/mockingservicestests/src/com/android/server/usage/OWNERS
new file mode 100644
index 0000000..d3227de
--- /dev/null
+++ b/services/tests/mockingservicestests/src/com/android/server/usage/OWNERS
@@ -0,0 +1 @@
+include /services/usage/OWNERS
diff --git a/services/tests/mockingservicestests/src/com/android/server/wallpaper/OWNERS b/services/tests/mockingservicestests/src/com/android/server/wallpaper/OWNERS
new file mode 100644
index 0000000..8ff0f74
--- /dev/null
+++ b/services/tests/mockingservicestests/src/com/android/server/wallpaper/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/service/wallpaper/OWNERS
diff --git a/services/tests/servicestests/apks/OWNERS b/services/tests/servicestests/apks/OWNERS
new file mode 100644
index 0000000..d825dfd
--- /dev/null
+++ b/services/tests/servicestests/apks/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/pm/OWNERS
diff --git a/services/tests/servicestests/assets/NetworkPolicy/OWNERS b/services/tests/servicestests/assets/NetworkPolicy/OWNERS
new file mode 100644
index 0000000..aa87958
--- /dev/null
+++ b/services/tests/servicestests/assets/NetworkPolicy/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/net/OWNERS
diff --git a/services/tests/servicestests/assets/NetworkPolicyManagerServiceTest/OWNERS b/services/tests/servicestests/assets/NetworkPolicyManagerServiceTest/OWNERS
new file mode 100644
index 0000000..aa87958
--- /dev/null
+++ b/services/tests/servicestests/assets/NetworkPolicyManagerServiceTest/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/net/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/OWNERS b/services/tests/servicestests/src/com/android/server/OWNERS
new file mode 100644
index 0000000..6153db3
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/OWNERS
@@ -0,0 +1,6 @@
+per-file *Alarm* = file:/apex/jobscheduler/OWNERS
+per-file *AppOps* = file:/core/java/android/permission/OWNERS
+per-file *Bluetooth* = file:/core/java/android/bluetooth/OWNERS
+per-file *Gnss* = file:/services/core/java/com/android/server/location/OWNERS
+per-file *Network* = file:/services/core/java/com/android/server/net/OWNERS
+per-file *Vibrator* = file:/services/core/java/com/android/server/vibrator/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/accessibility/OWNERS b/services/tests/servicestests/src/com/android/server/accessibility/OWNERS
new file mode 100644
index 0000000..b74281e
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/accessibility/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/view/accessibility/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/accounts/OWNERS b/services/tests/servicestests/src/com/android/server/accounts/OWNERS
new file mode 100644
index 0000000..df1b4f4
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/accounts/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/accounts/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/adb/OWNERS b/services/tests/servicestests/src/com/android/server/adb/OWNERS
new file mode 100644
index 0000000..b97f795
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/adb/OWNERS
@@ -0,0 +1 @@
+include platform/packages/modules/adb:/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/am/OWNERS b/services/tests/servicestests/src/com/android/server/am/OWNERS
new file mode 100644
index 0000000..72c0a9e
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/am/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/am/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/appop/OWNERS b/services/tests/servicestests/src/com/android/server/appop/OWNERS
new file mode 100644
index 0000000..999ea0e
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/appop/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/permission/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/appsearch/OWNERS b/services/tests/servicestests/src/com/android/server/appsearch/OWNERS
new file mode 100644
index 0000000..ebe9e4e
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/appsearch/OWNERS
@@ -0,0 +1 @@
+include /apex/appsearch/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/attention/OWNERS b/services/tests/servicestests/src/com/android/server/attention/OWNERS
new file mode 100644
index 0000000..51fc9bd
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/attention/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/attention/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/backup/OWNERS b/services/tests/servicestests/src/com/android/server/backup/OWNERS
new file mode 100644
index 0000000..d99779e
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/backup/OWNERS
@@ -0,0 +1 @@
+include /services/backup/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/compat/OWNERS b/services/tests/servicestests/src/com/android/server/compat/OWNERS
new file mode 100644
index 0000000..f8c3520
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/compat/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/compat/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/devicepolicy/OWNERS b/services/tests/servicestests/src/com/android/server/devicepolicy/OWNERS
new file mode 100644
index 0000000..e95633a
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/devicepolicy/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/app/admin/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/devicestate/OWNERS b/services/tests/servicestests/src/com/android/server/devicestate/OWNERS
new file mode 100644
index 0000000..d9b0e2e
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/devicestate/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/devicestate/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/display/OWNERS b/services/tests/servicestests/src/com/android/server/display/OWNERS
new file mode 100644
index 0000000..6ce1ee4
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/display/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/display/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/hdmi/OWNERS b/services/tests/servicestests/src/com/android/server/hdmi/OWNERS
new file mode 100644
index 0000000..c3c47ed
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/hdmi/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/hardware/hdmi/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/input/OWNERS b/services/tests/servicestests/src/com/android/server/input/OWNERS
new file mode 100644
index 0000000..d701f23
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/input/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/hardware/input/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/inputmethod/OWNERS b/services/tests/servicestests/src/com/android/server/inputmethod/OWNERS
new file mode 100644
index 0000000..5deb2ce
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/inputmethod/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/view/inputmethod/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/integrity/OWNERS b/services/tests/servicestests/src/com/android/server/integrity/OWNERS
new file mode 100644
index 0000000..653d1c9
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/integrity/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/integrity/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/job/OWNERS b/services/tests/servicestests/src/com/android/server/job/OWNERS
new file mode 100644
index 0000000..6f207fb1
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/job/OWNERS
@@ -0,0 +1 @@
+include /apex/jobscheduler/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/lights/OWNERS b/services/tests/servicestests/src/com/android/server/lights/OWNERS
new file mode 100644
index 0000000..cb46a80
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/lights/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/lights/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsShellCommandTest.java b/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsShellCommandTest.java
index 2205694..25dbc6b 100644
--- a/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsShellCommandTest.java
+++ b/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsShellCommandTest.java
@@ -16,6 +16,9 @@
package com.android.server.locksettings;
+import static android.app.admin.DevicePolicyManager.PASSWORD_COMPLEXITY_HIGH;
+import static android.app.admin.DevicePolicyManager.PASSWORD_COMPLEXITY_LOW;
+import static android.app.admin.DevicePolicyManager.PASSWORD_COMPLEXITY_MEDIUM;
import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC;
import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_COMPLEX;
import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_NUMERIC;
@@ -277,6 +280,94 @@
verify(mLockPatternUtils, never()).setLockCredential(any(), any(), anyInt());
}
+ @Test
+ public void testSetPin_nonCompliantWithComplexity() throws Exception {
+ when(mLockPatternUtils.isSecure(mUserId)).thenReturn(true);
+ when(mLockPatternUtils.isLockPatternEnabled(mUserId)).thenReturn(false);
+ when(mLockPatternUtils.isLockPasswordEnabled(mUserId)).thenReturn(true);
+ when(mLockPatternUtils.getKeyguardStoredPasswordQuality(mUserId)).thenReturn(
+ PASSWORD_QUALITY_NUMERIC);
+ when(mLockPatternUtils.checkCredential(
+ LockscreenCredential.createPin("1234"), mUserId, null)).thenReturn(true);
+ when(mLockPatternUtils.getRequestedPasswordMetrics(mUserId))
+ .thenReturn(metricsForAdminQuality(PASSWORD_QUALITY_UNSPECIFIED));
+ when(mLockPatternUtils.getRequestedPasswordComplexity(mUserId))
+ .thenReturn(PASSWORD_COMPLEXITY_MEDIUM);
+
+ assertEquals(-1, mCommand.exec(new Binder(), in, out, err,
+ new String[] { "set-pin", "--old", "1234", "4321" },
+ mShellCallback, mResultReceiver));
+
+ verify(mLockPatternUtils, never()).setLockCredential(any(), any(), anyInt());
+ }
+
+ @Test
+ public void testSetPin_compliantWithComplexity() throws Exception {
+ when(mLockPatternUtils.isSecure(mUserId)).thenReturn(true);
+ when(mLockPatternUtils.isLockPatternEnabled(mUserId)).thenReturn(false);
+ when(mLockPatternUtils.isLockPasswordEnabled(mUserId)).thenReturn(true);
+ when(mLockPatternUtils.getKeyguardStoredPasswordQuality(mUserId)).thenReturn(
+ PASSWORD_QUALITY_NUMERIC);
+ when(mLockPatternUtils.checkCredential(
+ LockscreenCredential.createPin("1234"), mUserId, null)).thenReturn(true);
+ when(mLockPatternUtils.getRequestedPasswordMetrics(mUserId))
+ .thenReturn(metricsForAdminQuality(PASSWORD_QUALITY_UNSPECIFIED));
+ when(mLockPatternUtils.getRequestedPasswordComplexity(mUserId))
+ .thenReturn(PASSWORD_COMPLEXITY_MEDIUM);
+
+ assertEquals(0, mCommand.exec(new Binder(), in, out, err,
+ new String[] { "set-pin", "--old", "1234", "4231" },
+ mShellCallback, mResultReceiver));
+
+ verify(mLockPatternUtils).setLockCredential(
+ LockscreenCredential.createPin("4231"),
+ LockscreenCredential.createPin("1234"),
+ mUserId);
+ }
+
+ @Test
+ public void testSetPattern_nonCompliantWithComplexity() throws Exception {
+ when(mLockPatternUtils.isSecure(mUserId)).thenReturn(true);
+ when(mLockPatternUtils.isLockPatternEnabled(mUserId)).thenReturn(true);
+ when(mLockPatternUtils.isLockPasswordEnabled(mUserId)).thenReturn(false);
+ when(mLockPatternUtils.checkCredential(
+ LockscreenCredential.createPattern(stringToPattern("1234")),
+ mUserId, null)).thenReturn(true);
+ when(mLockPatternUtils.getRequestedPasswordMetrics(mUserId))
+ .thenReturn(metricsForAdminQuality(PASSWORD_QUALITY_UNSPECIFIED));
+ when(mLockPatternUtils.getRequestedPasswordComplexity(mUserId))
+ .thenReturn(PASSWORD_COMPLEXITY_HIGH);
+
+ assertEquals(-1, mCommand.exec(new Binder(), in, out, err,
+ new String[] { "set-pattern", "--old", "1234", "4321" },
+ mShellCallback, mResultReceiver));
+
+ verify(mLockPatternUtils, never()).setLockCredential(any(), any(), anyInt());
+ }
+
+ @Test
+ public void testSetPattern_compliantWithComplexity() throws Exception {
+ when(mLockPatternUtils.isSecure(mUserId)).thenReturn(true);
+ when(mLockPatternUtils.isLockPatternEnabled(mUserId)).thenReturn(true);
+ when(mLockPatternUtils.isLockPasswordEnabled(mUserId)).thenReturn(false);
+ when(mLockPatternUtils.checkCredential(
+ LockscreenCredential.createPattern(stringToPattern("1234")),
+ mUserId, null)).thenReturn(true);
+ when(mLockPatternUtils.getRequestedPasswordMetrics(mUserId))
+ .thenReturn(metricsForAdminQuality(PASSWORD_QUALITY_UNSPECIFIED));
+ when(mLockPatternUtils.getRequestedPasswordComplexity(mUserId))
+ .thenReturn(PASSWORD_COMPLEXITY_LOW);
+
+ assertEquals(0, mCommand.exec(new Binder(), in, out, err,
+ new String[] { "set-pattern", "--old", "1234", "4321" },
+ mShellCallback, mResultReceiver));
+
+ verify(mLockPatternUtils).setLockCredential(
+ LockscreenCredential.createPattern(stringToPattern("4321")),
+ LockscreenCredential.createPattern(stringToPattern("1234")),
+ mUserId);
+ }
+
private List<LockPatternView.Cell> stringToPattern(String str) {
return LockPatternUtils.byteArrayToPattern(str.getBytes());
}
diff --git a/services/tests/servicestests/src/com/android/server/locksettings/OWNERS b/services/tests/servicestests/src/com/android/server/locksettings/OWNERS
new file mode 100644
index 0000000..0a8dc8c
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/locksettings/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/locksettings/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/net/IpConfigStoreTest.java b/services/tests/servicestests/src/com/android/server/net/IpConfigStoreTest.java
index 7767a28..9d300a6 100644
--- a/services/tests/servicestests/src/com/android/server/net/IpConfigStoreTest.java
+++ b/services/tests/servicestests/src/com/android/server/net/IpConfigStoreTest.java
@@ -20,11 +20,11 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
+import android.net.InetAddresses;
import android.net.IpConfiguration;
import android.net.IpConfiguration.IpAssignment;
import android.net.IpConfiguration.ProxySettings;
import android.net.LinkAddress;
-import android.net.NetworkUtils;
import android.net.ProxyInfo;
import android.net.StaticIpConfiguration;
import android.util.ArrayMap;
@@ -79,8 +79,8 @@
StaticIpConfiguration staticIpConfiguration = new StaticIpConfiguration();
staticIpConfiguration.ipAddress = new LinkAddress(IP_ADDR_1);
- staticIpConfiguration.dnsServers.add(NetworkUtils.numericToInetAddress(DNS_IP_ADDR_1));
- staticIpConfiguration.dnsServers.add(NetworkUtils.numericToInetAddress(DNS_IP_ADDR_2));
+ staticIpConfiguration.dnsServers.add(InetAddresses.parseNumericAddress(DNS_IP_ADDR_1));
+ staticIpConfiguration.dnsServers.add(InetAddresses.parseNumericAddress(DNS_IP_ADDR_2));
ProxyInfo proxyInfo = new ProxyInfo("10.10.10.10", 88, "host1,host2");
diff --git a/services/tests/servicestests/src/com/android/server/net/OWNERS b/services/tests/servicestests/src/com/android/server/net/OWNERS
new file mode 100644
index 0000000..aa87958
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/net/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/net/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/om/OWNERS b/services/tests/servicestests/src/com/android/server/om/OWNERS
new file mode 100644
index 0000000..afb98d4
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/om/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/content/om/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/people/OWNERS b/services/tests/servicestests/src/com/android/server/people/OWNERS
new file mode 100644
index 0000000..3198a5e
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/people/OWNERS
@@ -0,0 +1 @@
+include /services/people/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/pm/OWNERS b/services/tests/servicestests/src/com/android/server/pm/OWNERS
new file mode 100644
index 0000000..d825dfd
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/pm/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/pm/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/policy/OWNERS b/services/tests/servicestests/src/com/android/server/policy/OWNERS
new file mode 100644
index 0000000..0862c05
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/policy/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/wm/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/power/OWNERS b/services/tests/servicestests/src/com/android/server/power/OWNERS
new file mode 100644
index 0000000..d68066b
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/power/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/power/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/powerstats/OWNERS b/services/tests/servicestests/src/com/android/server/powerstats/OWNERS
new file mode 100644
index 0000000..d68066b
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/powerstats/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/power/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/rollback/OWNERS b/services/tests/servicestests/src/com/android/server/rollback/OWNERS
new file mode 100644
index 0000000..d04a706
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/rollback/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/rollback/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/soundtrigger_middleware/OWNERS b/services/tests/servicestests/src/com/android/server/soundtrigger_middleware/OWNERS
new file mode 100644
index 0000000..816bc6b
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/soundtrigger_middleware/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/media/soundtrigger/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/stats/OWNERS b/services/tests/servicestests/src/com/android/server/stats/OWNERS
new file mode 100644
index 0000000..ee865b1
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/stats/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/stats/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/storage/OWNERS b/services/tests/servicestests/src/com/android/server/storage/OWNERS
new file mode 100644
index 0000000..6f9dbea
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/storage/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/os/storage/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/textclassifier/OWNERS b/services/tests/servicestests/src/com/android/server/textclassifier/OWNERS
new file mode 100644
index 0000000..46b3cb8
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/textclassifier/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/service/textclassifier/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/timedetector/OWNERS b/services/tests/servicestests/src/com/android/server/timedetector/OWNERS
new file mode 100644
index 0000000..09447a97
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/timedetector/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/app/timezone/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/timezone/OWNERS b/services/tests/servicestests/src/com/android/server/timezone/OWNERS
new file mode 100644
index 0000000..09447a97
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/timezone/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/app/timezone/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/timezonedetector/OWNERS b/services/tests/servicestests/src/com/android/server/timezonedetector/OWNERS
new file mode 100644
index 0000000..09447a97
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/timezonedetector/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/app/timezone/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/tv/OWNERS b/services/tests/servicestests/src/com/android/server/tv/OWNERS
new file mode 100644
index 0000000..305027c
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/tv/OWNERS
@@ -0,0 +1 @@
+include /media/java/android/media/tv/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/uri/OWNERS b/services/tests/servicestests/src/com/android/server/uri/OWNERS
new file mode 100644
index 0000000..ca5d5f98
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/uri/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/uri/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/usage/OWNERS b/services/tests/servicestests/src/com/android/server/usage/OWNERS
new file mode 100644
index 0000000..d3227de
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/usage/OWNERS
@@ -0,0 +1 @@
+include /services/usage/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/vibrator/OWNERS b/services/tests/servicestests/src/com/android/server/vibrator/OWNERS
new file mode 100644
index 0000000..cc63ceb
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/vibrator/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/vibrator/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/wallpaper/OWNERS b/services/tests/servicestests/src/com/android/server/wallpaper/OWNERS
new file mode 100644
index 0000000..8ff0f74
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/wallpaper/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/service/wallpaper/OWNERS
diff --git a/services/tests/servicestests/test-apps/JobTestApp/OWNERS b/services/tests/servicestests/test-apps/JobTestApp/OWNERS
new file mode 100644
index 0000000..6f207fb1
--- /dev/null
+++ b/services/tests/servicestests/test-apps/JobTestApp/OWNERS
@@ -0,0 +1 @@
+include /apex/jobscheduler/OWNERS
diff --git a/services/tests/servicestests/test-apps/PackageParserApp/OWNERS b/services/tests/servicestests/test-apps/PackageParserApp/OWNERS
new file mode 100644
index 0000000..d825dfd
--- /dev/null
+++ b/services/tests/servicestests/test-apps/PackageParserApp/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/pm/OWNERS
diff --git a/services/tests/servicestests/test-apps/PackageParsingTestManifests/OWNERS b/services/tests/servicestests/test-apps/PackageParsingTestManifests/OWNERS
new file mode 100644
index 0000000..d825dfd
--- /dev/null
+++ b/services/tests/servicestests/test-apps/PackageParsingTestManifests/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/pm/OWNERS
diff --git a/services/tests/uiservicestests/src/com/android/server/OWNERS b/services/tests/uiservicestests/src/com/android/server/OWNERS
new file mode 100644
index 0000000..05944c0
--- /dev/null
+++ b/services/tests/uiservicestests/src/com/android/server/OWNERS
@@ -0,0 +1 @@
+per-file UiModeManagerServiceTest.java = file:/packages/SystemUI/OWNERS
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/OWNERS b/services/tests/uiservicestests/src/com/android/server/notification/OWNERS
new file mode 100644
index 0000000..396fd12
--- /dev/null
+++ b/services/tests/uiservicestests/src/com/android/server/notification/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/notification/OWNERS
diff --git a/services/tests/uiservicestests/src/com/android/server/slice/OWNERS b/services/tests/uiservicestests/src/com/android/server/slice/OWNERS
new file mode 100644
index 0000000..3d0859f
--- /dev/null
+++ b/services/tests/uiservicestests/src/com/android/server/slice/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/app/slice/OWNERS
diff --git a/services/tests/wmtests/OWNERS b/services/tests/wmtests/OWNERS
new file mode 100644
index 0000000..0862c05
--- /dev/null
+++ b/services/tests/wmtests/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/wm/OWNERS
diff --git a/services/tests/wmtests/src/com/android/server/wm/TaskSnapshotControllerTest.java b/services/tests/wmtests/src/com/android/server/wm/TaskSnapshotControllerTest.java
index 0bb2867..ec65085 100644
--- a/services/tests/wmtests/src/com/android/server/wm/TaskSnapshotControllerTest.java
+++ b/services/tests/wmtests/src/com/android/server/wm/TaskSnapshotControllerTest.java
@@ -30,6 +30,8 @@
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.when;
import android.app.ActivityManager;
import android.app.WindowConfiguration;
@@ -183,6 +185,24 @@
}
}
+ @UseTestDisplay(addWindows = {W_ACTIVITY, W_INPUT_METHOD})
+ @Test
+ public void testCreateTaskSnapshotWithExcludingIme() {
+ Task task = mAppWindow.mActivityRecord.getTask();
+ spyOn(task);
+ spyOn(mDisplayContent);
+ when(task.getDisplayContent().isImeAttachedToApp()).thenReturn(false);
+ // Intentionally set the SurfaceControl of input method window as null.
+ mDisplayContent.mInputMethodWindow.setSurfaceControl(null);
+ // Verify no NPE happens when calling createTaskSnapshot.
+ try {
+ mWm.mTaskSnapshotController.createTaskSnapshot(mAppWindow.mActivityRecord.getTask(),
+ 1f /* scaleFraction */, PixelFormat.UNKNOWN, null /* outTaskSize */);
+ } catch (NullPointerException e) {
+ fail("There should be no exception when calling createTaskSnapshot");
+ }
+ }
+
@UseTestDisplay(addWindows = W_ACTIVITY)
@Test
public void testPrepareTaskSnapshot() {
diff --git a/services/voiceinteraction/OWNERS b/services/voiceinteraction/OWNERS
new file mode 100644
index 0000000..ef1061b
--- /dev/null
+++ b/services/voiceinteraction/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/service/voice/OWNERS
diff --git a/services/wifi/OWNERS b/services/wifi/OWNERS
new file mode 100644
index 0000000..2ae7065
--- /dev/null
+++ b/services/wifi/OWNERS
@@ -0,0 +1 @@
+include /wifi/OWNERS
diff --git a/telecomm/java/android/telecom/OWNERS b/telecomm/java/android/telecom/OWNERS
new file mode 100644
index 0000000..6656a01
--- /dev/null
+++ b/telecomm/java/android/telecom/OWNERS
@@ -0,0 +1,6 @@
+# Bug component: 20868
+
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/telephony/common/com/android/internal/telephony/TelephonyPermissions.java b/telephony/common/com/android/internal/telephony/TelephonyPermissions.java
index 0c46394..4bb7cc4 100644
--- a/telephony/common/com/android/internal/telephony/TelephonyPermissions.java
+++ b/telephony/common/com/android/internal/telephony/TelephonyPermissions.java
@@ -244,7 +244,9 @@
* <ul>
* <li>return true: if the caller has the READ_PRIVILEGED_PHONE_STATE permission, the calling
* package passes a DevicePolicyManager Device Owner / Profile Owner device identifier
- * access check, or the calling package has carrier privileges on any active subscription.
+ * access check, or the calling package has carrier privileges on any active
+ * subscription, or the calling package has the {@link
+ * Manifest.permission#USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER} appop permission.
* <li>throw SecurityException: if the caller does not meet any of the requirements and is
* targeting Q or is targeting pre-Q and does not have the READ_PHONE_STATE permission
* or carrier privileges of any active subscription.
@@ -256,6 +258,10 @@
*/
public static boolean checkCallingOrSelfReadDeviceIdentifiers(Context context, int subId,
String callingPackage, @Nullable String callingFeatureId, String message) {
+ if (checkCallingOrSelfUseIccAuthWithDeviceIdentifier(context, callingPackage,
+ callingFeatureId, message)) {
+ return true;
+ }
return checkPrivilegedReadPermissionOrCarrierPrivilegePermission(
context, subId, callingPackage, callingFeatureId, message, true);
}
@@ -267,7 +273,9 @@
* <ul>
* <li>return true: if the caller has the READ_PRIVILEGED_PHONE_STATE permission, the calling
* package passes a DevicePolicyManager Device Owner / Profile Owner device identifier
- * access check, or the calling package has carrier privileges on specified subscription.
+ * access check, or the calling package has carrier privileges on specified subscription,
+ * or the calling package has the {@link
+ * Manifest.permission#USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER} appop permission.
* <li>throw SecurityException: if the caller does not meet any of the requirements and is
* targeting Q or is targeting pre-Q and does not have the READ_PHONE_STATE permission.
* <li>return false: if the caller is targeting pre-Q and does have the READ_PHONE_STATE
@@ -278,6 +286,10 @@
*/
public static boolean checkCallingOrSelfReadSubscriberIdentifiers(Context context, int subId,
String callingPackage, @Nullable String callingFeatureId, String message) {
+ if (checkCallingOrSelfUseIccAuthWithDeviceIdentifier(context, callingPackage,
+ callingFeatureId, message)) {
+ return true;
+ }
return checkPrivilegedReadPermissionOrCarrierPrivilegePermission(
context, subId, callingPackage, callingFeatureId, message, false);
}
@@ -385,6 +397,26 @@
}
/**
+ * Check whether the caller (or self, if not processing an IPC) has {@link
+ * Manifest.permission#USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER} AppOp permission.
+ *
+ * <p>With the permission, the caller can access device/subscriber identifiers and use ICC
+ * authentication like EAP-AKA.
+ */
+ public static boolean checkCallingOrSelfUseIccAuthWithDeviceIdentifier(Context context,
+ String callingPackage, String callingFeatureId, String message) {
+ // Cannot perform appop check if the calling package is null
+ if (callingPackage == null) {
+ return false;
+ }
+ int callingUid = Binder.getCallingUid();
+ AppOpsManager appOps = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
+ int opMode = appOps.noteOpNoThrow(AppOpsManager.OPSTR_USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER,
+ callingUid, callingPackage, callingFeatureId, message);
+ return opMode == AppOpsManager.MODE_ALLOWED;
+ }
+
+ /**
* Check whether the app with the given pid/uid can read the call log.
* @return {@code true} if the specified app has the read call log permission and AppOpp granted
* to it, {@code false} otherwise.
diff --git a/telephony/java/android/service/euicc/OWNERS b/telephony/java/android/service/euicc/OWNERS
new file mode 100644
index 0000000..6aa399d
--- /dev/null
+++ b/telephony/java/android/service/euicc/OWNERS
@@ -0,0 +1,5 @@
+# Bug component: 20868
+
[email protected]
[email protected]
[email protected]
diff --git a/telephony/java/android/service/sms/OWNERS b/telephony/java/android/service/sms/OWNERS
new file mode 100644
index 0000000..6aa399d
--- /dev/null
+++ b/telephony/java/android/service/sms/OWNERS
@@ -0,0 +1,5 @@
+# Bug component: 20868
+
[email protected]
[email protected]
[email protected]
diff --git a/telephony/java/android/telephony/OWNERS b/telephony/java/android/telephony/OWNERS
new file mode 100644
index 0000000..6aa399d
--- /dev/null
+++ b/telephony/java/android/telephony/OWNERS
@@ -0,0 +1,5 @@
+# Bug component: 20868
+
[email protected]
[email protected]
[email protected]
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 239329c..f2dbfb9 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -2009,6 +2009,8 @@
* active subscription.
* <li>If the calling app is the default SMS role holder (see {@link
* RoleManager#isRoleHeld(String)}).
+ * <li>If the calling app has been granted the
+ * {@link Manifest.permission#USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER} permission.
* </ul>
*
* <p>If the calling app does not meet one of these requirements then this method will behave
@@ -4019,6 +4021,8 @@
* <li>If the calling app has carrier privileges (see {@link #hasCarrierPrivileges}).
* <li>If the calling app is the default SMS role holder (see {@link
* RoleManager#isRoleHeld(String)}).
+ * <li>If the calling app has been granted the
+ * {@link Manifest.permission#USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER} permission.
* </ul>
*
* <p>If the calling app does not meet one of these requirements then this method will behave
@@ -4043,33 +4047,8 @@
* for a subscription.
* Return null if it is unavailable.
*
- * <p>Starting with API level 29, persistent device identifiers are guarded behind additional
- * restrictions, and apps are recommended to use resettable identifiers (see <a
- * href="/training/articles/user-data-ids">Best practices for unique identifiers</a>). This
- * method can be invoked if one of the following requirements is met:
- * <ul>
- * <li>If the calling app has been granted the READ_PRIVILEGED_PHONE_STATE permission; this
- * is a privileged permission that can only be granted to apps preloaded on the device.
- * <li>If the calling app is the device or profile owner and has been granted the
- * {@link Manifest.permission#READ_PHONE_STATE} permission. The profile owner is an app that
- * owns a managed profile on the device; for more details see <a
- * href="https://developer.android.com/work/managed-profiles">Work profiles</a>.
- * Profile owner access is deprecated and will be removed in a future release.
- * <li>If the calling app has carrier privileges (see {@link #hasCarrierPrivileges}).
- * <li>If the calling app is the default SMS role holder (see {@link
- * RoleManager#isRoleHeld(String)}).
- * </ul>
- *
- * <p>If the calling app does not meet one of these requirements then this method will behave
- * as follows:
- *
- * <ul>
- * <li>If the calling app's target SDK is API level 28 or lower and the app has the
- * READ_PHONE_STATE permission then null is returned.</li>
- * <li>If the calling app's target SDK is API level 28 or lower and the app does not have
- * the READ_PHONE_STATE permission, or if the calling app is targeting API level 29 or
- * higher, then a SecurityException is thrown.</li>
- * </ul>
+ * See {@link #getSubscriberId()} for details on the required permissions and behavior
+ * when the caller does not hold sufficient permissions.
*
* @param subId whose subscriber id is returned
* @hide
@@ -5594,57 +5573,6 @@
}
}
- /**
- * Registers a listener object to receive notification of changes
- * in specified telephony states.
- * <p>
- * To register a listener, pass a {@link PhoneStateListener} and specify at least one telephony
- * state of interest in the events argument.
- *
- * At registration, and when a specified telephony state changes, the telephony manager invokes
- * the appropriate callback method on the listener object and passes the current (updated)
- * values.
- * <p>
- * To un-register a listener, pass the listener object and set the events argument to
- * {@link PhoneStateListener#LISTEN_NONE LISTEN_NONE} (0).
- *
- * If this TelephonyManager object has been created with {@link #createForSubscriptionId},
- * applies to the given subId. Otherwise, applies to
- * {@link SubscriptionManager#getDefaultSubscriptionId()}. To listen events for multiple subIds,
- * pass a separate listener object to each TelephonyManager object created with
- * {@link #createForSubscriptionId}.
- *
- * Note: if you call this method while in the middle of a binder transaction, you <b>must</b>
- * call {@link android.os.Binder#clearCallingIdentity()} before calling this method. A
- * {@link SecurityException} will be thrown otherwise.
- *
- * This API should be used sparingly -- large numbers of listeners will cause system
- * instability. If a process has registered too many listeners without unregistering them, it
- * may encounter an {@link IllegalStateException} when trying to register more listeners.
- *
- * @param events The telephony state(s) of interest to the listener,
- * as a bitwise-OR combination of {@link PhoneStateListener}
- * LISTEN_ flags.
- * @param listener The {@link PhoneStateListener} object to register
- * (or unregister)
- * @deprecated Use {@link #registerPhoneStateListener(Executor, PhoneStateListener)}.
- */
- @Deprecated
- public void listen(long events, @NonNull PhoneStateListener listener) {
- mTelephonyRegistryMgr = mContext.getSystemService(TelephonyRegistryManager.class);
- if (mTelephonyRegistryMgr != null) {
- if (events != PhoneStateListener.LISTEN_NONE) {
- mTelephonyRegistryMgr.registerPhoneStateListenerWithEvents(mSubId,
- getOpPackageName(), getAttributionTag(), listener,
- Long.valueOf(events).intValue(), getITelephony() != null);
- } else {
- unregisterPhoneStateListener(listener);
- }
- } else {
- throw new IllegalStateException("telephony service is null.");
- }
- }
-
/** @hide */
@Retention(RetentionPolicy.SOURCE)
@IntDef(prefix = {"ERI_"}, value = {
@@ -7226,8 +7154,13 @@
* Returns the response of authentication for the default subscription.
* Returns null if the authentication hasn't been successful
*
- * <p>Requires Permission: READ_PRIVILEGED_PHONE_STATE or that the calling
- * app has carrier privileges (see {@link #hasCarrierPrivileges}).
+ * <p>Requires one of the following permissions:
+ * <ul>
+ * <li>READ_PRIVILEGED_PHONE_STATE
+ * <li>the calling app has carrier privileges (see {@link #hasCarrierPrivileges}).
+ * <li>the calling app has been granted the
+ * {@link Manifest.permission#USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER} permission.
+ * </ul>
*
* @param appType the icc application type, like {@link #APPTYPE_USIM}
* @param authType the authentication type, {@link #AUTHTYPE_EAP_AKA} or
@@ -7252,7 +7185,8 @@
* Returns the response of USIM Authentication for specified subId.
* Returns null if the authentication hasn't been successful
*
- * <p>Requires that the calling app has carrier privileges (see {@link #hasCarrierPrivileges}).
+ * <p>See {@link #getIccAuthentication(int, int, String)} for details on the required
+ * permissions.
*
* @param subId subscription ID used for authentication
* @param appType the icc application type, like {@link #APPTYPE_USIM}
@@ -7275,7 +7209,8 @@
IPhoneSubInfo info = getSubscriberInfoService();
if (info == null)
return null;
- return info.getIccSimChallengeResponse(subId, appType, authType, data);
+ return info.getIccSimChallengeResponse(subId, appType, authType, data,
+ getOpPackageName(), getAttributionTag());
} catch (RemoteException ex) {
return null;
} catch (NullPointerException ex) {
@@ -10023,6 +9958,16 @@
*/
public static final int CARD_POWER_UP_PASS_THROUGH = 2;
+ /** @hide */
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef(prefix = {"CARD_POWER"},
+ value = {
+ CARD_POWER_DOWN,
+ CARD_POWER_UP,
+ CARD_POWER_UP_PASS_THROUGH,
+ })
+ public @interface SimPowerState {}
+
/**
* Set SIM card power state.
*
@@ -10033,12 +9978,17 @@
* Callers should monitor for {@link TelephonyIntents#ACTION_SIM_STATE_CHANGED}
* broadcasts to determine success or failure and timeout if needed.
*
+ * @deprecated prefer {@link setSimPowerState(int, Executor, Consumer<Integer>)}.
+ * There is no guarantee that SIM power changes will trigger ACTION_SIM_STATE_CHANGED on new
+ * devices.
+ *
* <p>Requires Permission:
* {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
*
* {@hide}
**/
@SystemApi
+ @Deprecated
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
public void setSimPowerState(int state) {
setSimPowerStateForSlot(getSlotIndex(), state);
@@ -10055,12 +10005,16 @@
* Callers should monitor for {@link TelephonyIntents#ACTION_SIM_STATE_CHANGED}
* broadcasts to determine success or failure and timeout if needed.
*
+ * @deprecated prefer {@link setSimPowerStateForSlot(int, int, Executor, Consumer<Integer>)}.
+ * changes will trigger ACTION_SIM_STATE_CHANGED on new devices.
+ *
* <p>Requires Permission:
* {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
*
* {@hide}
**/
@SystemApi
+ @Deprecated
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
public void setSimPowerStateForSlot(int slotIndex, int state) {
try {
@@ -10076,6 +10030,85 @@
}
/**
+ * Set SIM card power state.
+ *
+ * @param state State of SIM (power down, power up, pass through)
+ * @see #CARD_POWER_DOWN
+ * @see #CARD_POWER_UP
+ * @see #CARD_POWER_UP_PASS_THROUGH
+ * @param executor The executor of where the callback will execute.
+ * @param callback Callback will be triggered once it succeeds or failed.
+ * @see #SET_SIM_POWER_STATE_SUCCESS
+ * @see #SET_SIM_POWER_STATE_ALREADY_IN_STATE
+ * @see #SET_SIM_POWER_STATE_MODEM_ERROR
+ * @see #SET_SIM_POWER_STATE_SIM_ERROR
+ * @see #SET_SIM_POWER_STATE_NOT_SUPPORTED
+ * @throws IllegalArgumentException if requested SIM state is invalid
+ *
+ * <p>Requires Permission:
+ * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
+ *
+ * {@hide}
+ **/
+ @SystemApi
+ @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
+ public void setSimPowerState(@SimPowerState int state, @NonNull Executor executor,
+ @NonNull @SetSimPowerStateResult Consumer<Integer> callback) {
+ setSimPowerStateForSlot(getSlotIndex(), state, executor, callback);
+ }
+
+ /**
+ * Set SIM card power state.
+ *
+ * @param slotIndex SIM slot id
+ * @param state State of SIM (power down, power up, pass through)
+ * @see #CARD_POWER_DOWN
+ * @see #CARD_POWER_UP
+ * @see #CARD_POWER_UP_PASS_THROUGH
+ * @param executor The executor of where the callback will execute.
+ * @param callback Callback will be triggered once it succeeds or failed.
+ * @see #SET_SIM_POWER_STATE_SUCCESS
+ * @see #SET_SIM_POWER_STATE_ALREADY_IN_STATE
+ * @see #SET_SIM_POWER_STATE_MODEM_ERROR
+ * @see #SET_SIM_POWER_STATE_SIM_ERROR
+ * @see #SET_SIM_POWER_STATE_NOT_SUPPORTED
+ * @throws IllegalArgumentException if requested SIM state is invalid
+ *
+ * <p>Requires Permission:
+ * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
+ *
+ * {@hide}
+ **/
+ @SystemApi
+ @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
+ public void setSimPowerStateForSlot(int slotIndex, @SimPowerState int state,
+ @NonNull Executor executor,
+ @NonNull @SetSimPowerStateResult Consumer<Integer> callback) {
+ if (state != CARD_POWER_DOWN && state != CARD_POWER_UP
+ && state != CARD_POWER_UP_PASS_THROUGH) {
+ throw new IllegalArgumentException("requested SIM state is invalid");
+ }
+ try {
+ ITelephony telephony = getITelephony();
+ IIntegerConsumer internalCallback = new IIntegerConsumer.Stub() {
+ @Override
+ public void accept(int result) {
+ executor.execute(() ->
+ Binder.withCleanCallingIdentity(() -> callback.accept(result)));
+ }
+ };
+ if (telephony != null) {
+ telephony.setSimPowerStateForSlotWithCallback(slotIndex, state, internalCallback);
+ }
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error calling ITelephony#setSimPowerStateForSlot", e);
+ } catch (SecurityException e) {
+ Log.e(TAG, "Permission error calling ITelephony#setSimPowerStateForSlot",
+ e);
+ }
+ }
+
+ /**
* Set baseband version for the default phone.
*
* @param version baseband version
@@ -11194,6 +11227,55 @@
public @interface SetCarrierRestrictionResult {}
/**
+ * The SIM power state was successfully set.
+ * @hide
+ */
+ @SystemApi
+ public static final int SET_SIM_POWER_STATE_SUCCESS = 0;
+
+ /**
+ * The SIM is already in the requested power state.
+ * @hide
+ */
+ @SystemApi
+ public static final int SET_SIM_POWER_STATE_ALREADY_IN_STATE = 1;
+
+ /**
+ * Failed to connect to the modem to make the power state request. This may happen if the
+ * modem has an error. The user may want to make the request again later.
+ * @hide
+ */
+ @SystemApi
+ public static final int SET_SIM_POWER_STATE_MODEM_ERROR = 2;
+
+ /**
+ * Failed to connect to the SIM to make the power state request. This may happen if the
+ * SIM has been removed. The user may want to make the request again later.
+ * @hide
+ */
+ @SystemApi
+ public static final int SET_SIM_POWER_STATE_SIM_ERROR = 3;
+
+ /**
+ * The modem version does not support synchronous power.
+ * @hide
+ */
+ @SystemApi
+ public static final int SET_SIM_POWER_STATE_NOT_SUPPORTED = 4;
+
+ /** @hide */
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef(prefix = {"SET_SIM_POWER_STATE_"},
+ value = {
+ SET_SIM_POWER_STATE_SUCCESS,
+ SET_SIM_POWER_STATE_ALREADY_IN_STATE,
+ SET_SIM_POWER_STATE_MODEM_ERROR,
+ SET_SIM_POWER_STATE_SIM_ERROR,
+ SET_SIM_POWER_STATE_NOT_SUPPORTED
+ })
+ public @interface SetSimPowerStateResult {}
+
+ /**
* Set the allowed carrier list and the excluded carrier list indicating the priority between
* the two lists.
* Requires system privileges.
diff --git a/telephony/java/android/telephony/cdma/OWNERS b/telephony/java/android/telephony/cdma/OWNERS
new file mode 100644
index 0000000..6aa399d
--- /dev/null
+++ b/telephony/java/android/telephony/cdma/OWNERS
@@ -0,0 +1,5 @@
+# Bug component: 20868
+
[email protected]
[email protected]
[email protected]
diff --git a/telephony/java/android/telephony/data/OWNERS b/telephony/java/android/telephony/data/OWNERS
new file mode 100644
index 0000000..932b35c
--- /dev/null
+++ b/telephony/java/android/telephony/data/OWNERS
@@ -0,0 +1,5 @@
+# Bug component: 20868
+
[email protected]
[email protected]
[email protected]
diff --git a/telephony/java/android/telephony/emergency/OWNERS b/telephony/java/android/telephony/emergency/OWNERS
new file mode 100644
index 0000000..fa07dce
--- /dev/null
+++ b/telephony/java/android/telephony/emergency/OWNERS
@@ -0,0 +1,5 @@
+# Bug component: 20868
+
[email protected]
[email protected]
[email protected]
diff --git a/telephony/java/android/telephony/euicc/OWNERS b/telephony/java/android/telephony/euicc/OWNERS
new file mode 100644
index 0000000..9e51a4b
--- /dev/null
+++ b/telephony/java/android/telephony/euicc/OWNERS
@@ -0,0 +1,6 @@
+# Bug component: 20868
+
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/telephony/java/android/telephony/gsm/OWNERS b/telephony/java/android/telephony/gsm/OWNERS
new file mode 100644
index 0000000..6aa399d
--- /dev/null
+++ b/telephony/java/android/telephony/gsm/OWNERS
@@ -0,0 +1,5 @@
+# Bug component: 20868
+
[email protected]
[email protected]
[email protected]
diff --git a/telephony/java/android/telephony/ims/OWNERS b/telephony/java/android/telephony/ims/OWNERS
new file mode 100644
index 0000000..0854c5d
--- /dev/null
+++ b/telephony/java/android/telephony/ims/OWNERS
@@ -0,0 +1,5 @@
+# Bug component: 20868
+
[email protected]
[email protected]
[email protected]
diff --git a/telephony/java/android/telephony/ims/aidl/OWNERS b/telephony/java/android/telephony/ims/aidl/OWNERS
new file mode 100644
index 0000000..0854c5d
--- /dev/null
+++ b/telephony/java/android/telephony/ims/aidl/OWNERS
@@ -0,0 +1,5 @@
+# Bug component: 20868
+
[email protected]
[email protected]
[email protected]
diff --git a/telephony/java/android/telephony/ims/compat/OWNERS b/telephony/java/android/telephony/ims/compat/OWNERS
new file mode 100644
index 0000000..0854c5d
--- /dev/null
+++ b/telephony/java/android/telephony/ims/compat/OWNERS
@@ -0,0 +1,5 @@
+# Bug component: 20868
+
[email protected]
[email protected]
[email protected]
diff --git a/telephony/java/android/telephony/ims/compat/feature/OWNERS b/telephony/java/android/telephony/ims/compat/feature/OWNERS
new file mode 100644
index 0000000..0854c5d
--- /dev/null
+++ b/telephony/java/android/telephony/ims/compat/feature/OWNERS
@@ -0,0 +1,5 @@
+# Bug component: 20868
+
[email protected]
[email protected]
[email protected]
diff --git a/telephony/java/android/telephony/ims/compat/stub/OWNERS b/telephony/java/android/telephony/ims/compat/stub/OWNERS
new file mode 100644
index 0000000..0854c5d
--- /dev/null
+++ b/telephony/java/android/telephony/ims/compat/stub/OWNERS
@@ -0,0 +1,5 @@
+# Bug component: 20868
+
[email protected]
[email protected]
[email protected]
diff --git a/telephony/java/android/telephony/ims/feature/OWNERS b/telephony/java/android/telephony/ims/feature/OWNERS
new file mode 100644
index 0000000..0854c5d
--- /dev/null
+++ b/telephony/java/android/telephony/ims/feature/OWNERS
@@ -0,0 +1,5 @@
+# Bug component: 20868
+
[email protected]
[email protected]
[email protected]
diff --git a/telephony/java/android/telephony/ims/stub/OWNERS b/telephony/java/android/telephony/ims/stub/OWNERS
new file mode 100644
index 0000000..0854c5d
--- /dev/null
+++ b/telephony/java/android/telephony/ims/stub/OWNERS
@@ -0,0 +1,5 @@
+# Bug component: 20868
+
[email protected]
[email protected]
[email protected]
diff --git a/telephony/java/android/telephony/mbms/OWNERS b/telephony/java/android/telephony/mbms/OWNERS
new file mode 100644
index 0000000..718e0a2
--- /dev/null
+++ b/telephony/java/android/telephony/mbms/OWNERS
@@ -0,0 +1,5 @@
+# Bug component: 20868
+
[email protected]
[email protected]
[email protected]
diff --git a/telephony/java/android/telephony/mbms/vendor/OWNERS b/telephony/java/android/telephony/mbms/vendor/OWNERS
new file mode 100644
index 0000000..718e0a2
--- /dev/null
+++ b/telephony/java/android/telephony/mbms/vendor/OWNERS
@@ -0,0 +1,5 @@
+# Bug component: 20868
+
[email protected]
[email protected]
[email protected]
diff --git a/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl b/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl
index 09f9b42..ce2017b 100644
--- a/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl
+++ b/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl
@@ -216,5 +216,6 @@
* @param data authentication challenge data
* @return challenge response
*/
- String getIccSimChallengeResponse(int subId, int appType, int authType, String data);
+ String getIccSimChallengeResponse(int subId, int appType, int authType, String data,
+ String callingPackage, String callingFeatureId);
}
diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl
index 5d4fdd0..1af3ea1 100644
--- a/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl
@@ -1674,10 +1674,19 @@
* @param slotIndex SIM slot id
* @param state State of SIM (power down, power up, pass through)
* @hide
- * */
+ */
void setSimPowerStateForSlot(int slotIndex, int state);
/**
+ * Set SIM card power state.
+ * @param slotIndex SIM slot id
+ * @param state State of SIM (power down, power up, pass through)
+ * @param callback callback to receive result info
+ * @hide
+ */
+ void setSimPowerStateForSlotWithCallback(int slotIndex, int state, IIntegerConsumer callback);
+
+ /**
* Returns a list of Forbidden PLMNs from the specified SIM App
* Returns null if the query fails.
*
diff --git a/tests/ActivityManagerPerfTests/OWNERS b/tests/ActivityManagerPerfTests/OWNERS
new file mode 100644
index 0000000..72c0a9e
--- /dev/null
+++ b/tests/ActivityManagerPerfTests/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/am/OWNERS
diff --git a/tests/AmSlam/OWNERS b/tests/AmSlam/OWNERS
new file mode 100644
index 0000000..72c0a9e
--- /dev/null
+++ b/tests/AmSlam/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/am/OWNERS
diff --git a/tests/BlobStoreTestUtils/OWNERS b/tests/BlobStoreTestUtils/OWNERS
new file mode 100644
index 0000000..65bb6b8
--- /dev/null
+++ b/tests/BlobStoreTestUtils/OWNERS
@@ -0,0 +1 @@
+include /apex/blobstore/OWNERS
diff --git a/tests/Camera2Tests/OWNERS b/tests/Camera2Tests/OWNERS
new file mode 100644
index 0000000..f48a95c
--- /dev/null
+++ b/tests/Camera2Tests/OWNERS
@@ -0,0 +1 @@
+include platform/frameworks/av:/camera/OWNERS
diff --git a/tests/CanvasCompare/OWNERS b/tests/CanvasCompare/OWNERS
new file mode 100644
index 0000000..c88a9f8
--- /dev/null
+++ b/tests/CanvasCompare/OWNERS
@@ -0,0 +1 @@
+include /libs/hwui/OWNERS
diff --git a/tests/Compatibility/OWNERS b/tests/Compatibility/OWNERS
new file mode 100644
index 0000000..f8c3520
--- /dev/null
+++ b/tests/Compatibility/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/compat/OWNERS
diff --git a/tests/DozeTest/OWNERS b/tests/DozeTest/OWNERS
new file mode 100644
index 0000000..2e96c97
--- /dev/null
+++ b/tests/DozeTest/OWNERS
@@ -0,0 +1 @@
+include /packages/SystemUI/OWNERS
diff --git a/tests/FixVibrateSetting/OWNERS b/tests/FixVibrateSetting/OWNERS
new file mode 100644
index 0000000..cc63ceb
--- /dev/null
+++ b/tests/FixVibrateSetting/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/vibrator/OWNERS
diff --git a/tests/FlickerTests/OWNERS b/tests/FlickerTests/OWNERS
new file mode 100644
index 0000000..0862c05
--- /dev/null
+++ b/tests/FlickerTests/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/wm/OWNERS
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/ReOpenImeWindowTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/ime/ReOpenImeWindowTest.kt
index 7b5dc872..7bd96f5 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/ReOpenImeWindowTest.kt
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/ime/ReOpenImeWindowTest.kt
@@ -16,6 +16,7 @@
package com.android.server.wm.flicker.ime
+import androidx.test.filters.FlakyTest
import android.view.Surface
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
@@ -42,6 +43,7 @@
@RequiresDevice
@RunWith(Parameterized::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+@FlakyTest(bugId = 175027130)
class ReOpenImeWindowTest(
testName: String,
flickerSpec: Flicker
diff --git a/tests/HugeBackup/OWNERS b/tests/HugeBackup/OWNERS
new file mode 100644
index 0000000..d99779e
--- /dev/null
+++ b/tests/HugeBackup/OWNERS
@@ -0,0 +1 @@
+include /services/backup/OWNERS
diff --git a/tests/HwAccelerationTest/OWNERS b/tests/HwAccelerationTest/OWNERS
new file mode 100644
index 0000000..c88a9f8
--- /dev/null
+++ b/tests/HwAccelerationTest/OWNERS
@@ -0,0 +1 @@
+include /libs/hwui/OWNERS
diff --git a/tests/Input/OWNERS b/tests/Input/OWNERS
new file mode 100644
index 0000000..d701f23
--- /dev/null
+++ b/tests/Input/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/hardware/input/OWNERS
diff --git a/tests/JobSchedulerPerfTests/OWNERS b/tests/JobSchedulerPerfTests/OWNERS
new file mode 100644
index 0000000..6f207fb1
--- /dev/null
+++ b/tests/JobSchedulerPerfTests/OWNERS
@@ -0,0 +1 @@
+include /apex/jobscheduler/OWNERS
diff --git a/tests/JobSchedulerTestApp/OWNERS b/tests/JobSchedulerTestApp/OWNERS
new file mode 100644
index 0000000..6f207fb1
--- /dev/null
+++ b/tests/JobSchedulerTestApp/OWNERS
@@ -0,0 +1 @@
+include /apex/jobscheduler/OWNERS
diff --git a/tests/LocationTracker/OWNERS b/tests/LocationTracker/OWNERS
new file mode 100644
index 0000000..5ac60284
--- /dev/null
+++ b/tests/LocationTracker/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/location/OWNERS
diff --git a/tests/LowStorageTest/OWNERS b/tests/LowStorageTest/OWNERS
new file mode 100644
index 0000000..6f9dbea
--- /dev/null
+++ b/tests/LowStorageTest/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/os/storage/OWNERS
diff --git a/tests/NetworkSecurityConfigTest/OWNERS b/tests/NetworkSecurityConfigTest/OWNERS
new file mode 100644
index 0000000..aa87958
--- /dev/null
+++ b/tests/NetworkSecurityConfigTest/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/net/OWNERS
diff --git a/tests/PackageWatchdog/OWNERS b/tests/PackageWatchdog/OWNERS
new file mode 100644
index 0000000..d04a706
--- /dev/null
+++ b/tests/PackageWatchdog/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/rollback/OWNERS
diff --git a/tests/PackageWatchdog/src/com/android/server/OWNERS b/tests/PackageWatchdog/src/com/android/server/OWNERS
new file mode 100644
index 0000000..5cf4dcf
--- /dev/null
+++ b/tests/PackageWatchdog/src/com/android/server/OWNERS
@@ -0,0 +1 @@
+per-file PackageWatchdogTest.java = file:/services/core/java/com/android/server/rollback/OWNERS
diff --git a/tests/PlatformCompatGating/OWNERS b/tests/PlatformCompatGating/OWNERS
new file mode 100644
index 0000000..f8c3520
--- /dev/null
+++ b/tests/PlatformCompatGating/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/compat/OWNERS
diff --git a/tests/RollbackTest/OWNERS b/tests/RollbackTest/OWNERS
new file mode 100644
index 0000000..d04a706
--- /dev/null
+++ b/tests/RollbackTest/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/rollback/OWNERS
diff --git a/tests/SoundTriggerTestApp/OWNERS b/tests/SoundTriggerTestApp/OWNERS
new file mode 100644
index 0000000..816bc6b
--- /dev/null
+++ b/tests/SoundTriggerTestApp/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/media/soundtrigger/OWNERS
diff --git a/tests/SoundTriggerTests/OWNERS b/tests/SoundTriggerTests/OWNERS
new file mode 100644
index 0000000..816bc6b
--- /dev/null
+++ b/tests/SoundTriggerTests/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/media/soundtrigger/OWNERS
diff --git a/tests/StagedInstallTest/OWNERS b/tests/StagedInstallTest/OWNERS
new file mode 100644
index 0000000..d825dfd
--- /dev/null
+++ b/tests/StagedInstallTest/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/pm/OWNERS
diff --git a/tests/StatusBar/OWNERS b/tests/StatusBar/OWNERS
new file mode 100644
index 0000000..2e96c97
--- /dev/null
+++ b/tests/StatusBar/OWNERS
@@ -0,0 +1 @@
+include /packages/SystemUI/OWNERS
diff --git a/tests/TaskOrganizerTest/OWNERS b/tests/TaskOrganizerTest/OWNERS
new file mode 100644
index 0000000..0862c05
--- /dev/null
+++ b/tests/TaskOrganizerTest/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/wm/OWNERS
diff --git a/tests/TelephonyCommonTests/OWNERS b/tests/TelephonyCommonTests/OWNERS
new file mode 100644
index 0000000..640baf2
--- /dev/null
+++ b/tests/TelephonyCommonTests/OWNERS
@@ -0,0 +1 @@
+include /telephony/OWNERS
diff --git a/tests/UsageReportingTest/OWNERS b/tests/UsageReportingTest/OWNERS
new file mode 100644
index 0000000..d3227de
--- /dev/null
+++ b/tests/UsageReportingTest/OWNERS
@@ -0,0 +1 @@
+include /services/usage/OWNERS
diff --git a/tests/UsageStatsPerfTests/OWNERS b/tests/UsageStatsPerfTests/OWNERS
new file mode 100644
index 0000000..d3227de
--- /dev/null
+++ b/tests/UsageStatsPerfTests/OWNERS
@@ -0,0 +1 @@
+include /services/usage/OWNERS
diff --git a/tests/UsageStatsTest/OWNERS b/tests/UsageStatsTest/OWNERS
new file mode 100644
index 0000000..d3227de
--- /dev/null
+++ b/tests/UsageStatsTest/OWNERS
@@ -0,0 +1 @@
+include /services/usage/OWNERS
diff --git a/tests/UsbHostExternalManagmentTest/OWNERS b/tests/UsbHostExternalManagmentTest/OWNERS
new file mode 100644
index 0000000..f7b2a37
--- /dev/null
+++ b/tests/UsbHostExternalManagmentTest/OWNERS
@@ -0,0 +1 @@
+include /services/usb/OWNERS
diff --git a/tests/UsbManagerTests/OWNERS b/tests/UsbManagerTests/OWNERS
new file mode 100644
index 0000000..f7b2a37
--- /dev/null
+++ b/tests/UsbManagerTests/OWNERS
@@ -0,0 +1 @@
+include /services/usb/OWNERS
diff --git a/tests/UsbTests/OWNERS b/tests/UsbTests/OWNERS
new file mode 100644
index 0000000..f7b2a37
--- /dev/null
+++ b/tests/UsbTests/OWNERS
@@ -0,0 +1 @@
+include /services/usb/OWNERS
diff --git a/tests/VoiceInteraction/OWNERS b/tests/VoiceInteraction/OWNERS
new file mode 100644
index 0000000..ef1061b
--- /dev/null
+++ b/tests/VoiceInteraction/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/service/voice/OWNERS
diff --git a/tests/WindowAnimationJank/OWNERS b/tests/WindowAnimationJank/OWNERS
new file mode 100644
index 0000000..0862c05
--- /dev/null
+++ b/tests/WindowAnimationJank/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/wm/OWNERS
diff --git a/tests/WindowInsetsTests/OWNERS b/tests/WindowInsetsTests/OWNERS
new file mode 100644
index 0000000..0862c05
--- /dev/null
+++ b/tests/WindowInsetsTests/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/wm/OWNERS
diff --git a/tests/backup/OWNERS b/tests/backup/OWNERS
new file mode 100644
index 0000000..d99779e
--- /dev/null
+++ b/tests/backup/OWNERS
@@ -0,0 +1 @@
+include /services/backup/OWNERS
diff --git a/tests/benchmarks/src/com/android/server/net/OWNERS b/tests/benchmarks/src/com/android/server/net/OWNERS
new file mode 100644
index 0000000..aa87958
--- /dev/null
+++ b/tests/benchmarks/src/com/android/server/net/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/net/OWNERS
diff --git a/tests/net/common/java/android/net/LinkAddressTest.java b/tests/net/common/java/android/net/LinkAddressTest.java
index 60308e3..1eaf30c 100644
--- a/tests/net/common/java/android/net/LinkAddressTest.java
+++ b/tests/net/common/java/android/net/LinkAddressTest.java
@@ -68,8 +68,8 @@
private static final String V4 = "192.0.2.1";
private static final String V6 = "2001:db8::1";
- private static final InetAddress V4_ADDRESS = NetworkUtils.numericToInetAddress(V4);
- private static final InetAddress V6_ADDRESS = NetworkUtils.numericToInetAddress(V6);
+ private static final InetAddress V4_ADDRESS = InetAddresses.parseNumericAddress(V4);
+ private static final InetAddress V6_ADDRESS = InetAddresses.parseNumericAddress(V6);
@Test
public void testConstants() {
@@ -131,10 +131,10 @@
ipv6Loopback = new LinkAddress(addrs.get(0));
}
- assertEquals(NetworkUtils.numericToInetAddress("127.0.0.1"), ipv4Loopback.getAddress());
+ assertEquals(InetAddresses.parseNumericAddress("127.0.0.1"), ipv4Loopback.getAddress());
assertEquals(8, ipv4Loopback.getPrefixLength());
- assertEquals(NetworkUtils.numericToInetAddress("::1"), ipv6Loopback.getAddress());
+ assertEquals(InetAddresses.parseNumericAddress("::1"), ipv6Loopback.getAddress());
assertEquals(128, ipv6Loopback.getPrefixLength());
// Null addresses are rejected.
diff --git a/tests/net/java/com/android/server/ConnectivityServiceTest.java b/tests/net/java/com/android/server/ConnectivityServiceTest.java
index b9fa7ea..b6f91c4 100644
--- a/tests/net/java/com/android/server/ConnectivityServiceTest.java
+++ b/tests/net/java/com/android/server/ConnectivityServiceTest.java
@@ -181,7 +181,6 @@
import android.net.NetworkStackClient;
import android.net.NetworkState;
import android.net.NetworkTestResultParcelable;
-import android.net.NetworkUtils;
import android.net.ProxyInfo;
import android.net.ResolverParamsParcel;
import android.net.RouteInfo;
@@ -1958,6 +1957,57 @@
}
@Test
+ public void testOwnerUidChangeBug() throws Exception {
+ // Owner UIDs are not visible without location permission.
+ setupLocationPermissions(Build.VERSION_CODES.Q, true, AppOpsManager.OPSTR_FINE_LOCATION,
+ Manifest.permission.ACCESS_FINE_LOCATION);
+
+ final NetworkCapabilities ncTemplate = new NetworkCapabilities();
+ final int originalOwnerUid = Process.myUid();
+ ncTemplate.setOwnerUid(originalOwnerUid);
+
+ mWiFiNetworkAgent = new TestNetworkAgentWrapper(TRANSPORT_WIFI, new LinkProperties(),
+ ncTemplate);
+ mWiFiNetworkAgent.connect(false);
+ waitForIdle();
+
+ // Send ConnectivityService an update to the mWiFiNetworkAgent's capabilities that changes
+ // its owner UID.
+ NetworkCapabilities agentCapabilities = mWiFiNetworkAgent.getNetworkCapabilities();
+ assertEquals(originalOwnerUid, agentCapabilities.getOwnerUid());
+ agentCapabilities.setOwnerUid(42);
+ mWiFiNetworkAgent.setNetworkCapabilities(agentCapabilities, true);
+ waitForIdle();
+
+ // Check that the owner UID is not updated.
+ NetworkCapabilities nc = mCm.getNetworkCapabilities(mWiFiNetworkAgent.getNetwork());
+ assertEquals(originalOwnerUid, nc.getOwnerUid());
+
+ // Make an unrelated change to the capabilities.
+ assertFalse(agentCapabilities.hasCapability(NET_CAPABILITY_NOT_CONGESTED));
+ agentCapabilities.addCapability(NET_CAPABILITY_NOT_CONGESTED);
+ mWiFiNetworkAgent.setNetworkCapabilities(agentCapabilities, true);
+ waitForIdle();
+
+ // Check that both the capability change and the owner UID have been modified.
+ // The owner UID is -1 because it is visible only to the UID that owns the network.
+ nc = mCm.getNetworkCapabilities(mWiFiNetworkAgent.getNetwork());
+ assertEquals(-1, nc.getOwnerUid());
+ assertTrue(nc.hasCapability(NET_CAPABILITY_NOT_CONGESTED));
+
+ // Set the owner back to originalOwnerUid, update the capabilities, and check that it is
+ // visible again.
+ // TODO: should this even be possible?
+ agentCapabilities.setOwnerUid(originalOwnerUid);
+ agentCapabilities.removeCapability(NET_CAPABILITY_NOT_CONGESTED);
+ mWiFiNetworkAgent.setNetworkCapabilities(agentCapabilities, true);
+ waitForIdle();
+
+ nc = mCm.getNetworkCapabilities(mWiFiNetworkAgent.getNetwork());
+ assertEquals(originalOwnerUid, nc.getOwnerUid());
+ }
+
+ @Test
public void testMultipleLingering() throws Exception {
// This test would be flaky with the default 120ms timer: that is short enough that
// lingered networks are torn down before assertions can be run. We don't want to mock the
@@ -4809,7 +4859,7 @@
lp.setInterfaceName(WIFI_IFNAME);
LinkAddress myIpv4Address = new LinkAddress("192.168.12.3/24");
RouteInfo myIpv4DefaultRoute = new RouteInfo((IpPrefix) null,
- NetworkUtils.numericToInetAddress("192.168.12.1"), lp.getInterfaceName());
+ InetAddresses.parseNumericAddress("192.168.12.1"), lp.getInterfaceName());
lp.addLinkAddress(myIpv4Address);
lp.addRoute(myIpv4DefaultRoute);
diff --git a/tests/net/java/com/android/server/IpSecServiceParameterizedTest.java b/tests/net/java/com/android/server/IpSecServiceParameterizedTest.java
index 529d03c..799bcc8 100644
--- a/tests/net/java/com/android/server/IpSecServiceParameterizedTest.java
+++ b/tests/net/java/com/android/server/IpSecServiceParameterizedTest.java
@@ -34,6 +34,7 @@
import android.content.Context;
import android.content.pm.PackageManager;
import android.net.INetd;
+import android.net.InetAddresses;
import android.net.IpSecAlgorithm;
import android.net.IpSecConfig;
import android.net.IpSecManager;
@@ -44,7 +45,6 @@
import android.net.IpSecUdpEncapResponse;
import android.net.LinkAddress;
import android.net.Network;
-import android.net.NetworkUtils;
import android.os.Binder;
import android.os.INetworkManagementService;
import android.os.ParcelFileDescriptor;
@@ -272,7 +272,7 @@
IpSecSpiResponse spi =
mIpSecService.allocateSecurityParameterIndex(
- NetworkUtils.numericToInetAddress(remoteAddress).getHostAddress(),
+ InetAddresses.parseNumericAddress(remoteAddress).getHostAddress(),
IpSecManager.INVALID_SECURITY_PARAMETER_INDEX,
new Binder());
return spi.resourceId;
diff --git a/tests/notification/OWNERS b/tests/notification/OWNERS
new file mode 100644
index 0000000..396fd12
--- /dev/null
+++ b/tests/notification/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/notification/OWNERS
diff --git a/tests/permission/OWNERS b/tests/permission/OWNERS
new file mode 100644
index 0000000..999ea0e
--- /dev/null
+++ b/tests/permission/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/permission/OWNERS
diff --git a/tests/utils/DummyIME/OWNERS b/tests/utils/DummyIME/OWNERS
new file mode 100644
index 0000000..5deb2ce
--- /dev/null
+++ b/tests/utils/DummyIME/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/view/inputmethod/OWNERS
diff --git a/tests/utils/StubIME/OWNERS b/tests/utils/StubIME/OWNERS
new file mode 100644
index 0000000..5deb2ce
--- /dev/null
+++ b/tests/utils/StubIME/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/view/inputmethod/OWNERS
diff --git a/tests/utils/hostutils/src/com/android/tests/rollback/OWNERS b/tests/utils/hostutils/src/com/android/tests/rollback/OWNERS
new file mode 100644
index 0000000..d04a706
--- /dev/null
+++ b/tests/utils/hostutils/src/com/android/tests/rollback/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/rollback/OWNERS
diff --git a/tests/utils/testutils/java/com/android/server/accessibility/OWNERS b/tests/utils/testutils/java/com/android/server/accessibility/OWNERS
new file mode 100644
index 0000000..b74281e
--- /dev/null
+++ b/tests/utils/testutils/java/com/android/server/accessibility/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/view/accessibility/OWNERS
diff --git a/tests/utils/testutils/java/com/android/server/wm/OWNERS b/tests/utils/testutils/java/com/android/server/wm/OWNERS
new file mode 100644
index 0000000..0862c05
--- /dev/null
+++ b/tests/utils/testutils/java/com/android/server/wm/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/wm/OWNERS
diff --git a/tools/aapt/OWNERS b/tools/aapt/OWNERS
new file mode 100644
index 0000000..c232ccd
--- /dev/null
+++ b/tools/aapt/OWNERS
@@ -0,0 +1 @@
+include /tools/aapt2/OWNERS
diff --git a/tools/fonts/OWNERS b/tools/fonts/OWNERS
new file mode 100644
index 0000000..a538331
--- /dev/null
+++ b/tools/fonts/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/graphics/fonts/OWNERS
diff --git a/tools/incident_report/OWNERS b/tools/incident_report/OWNERS
new file mode 100644
index 0000000..f766115
--- /dev/null
+++ b/tools/incident_report/OWNERS
@@ -0,0 +1 @@
+include /cmds/incidentd/OWNERS
diff --git a/tools/incident_section_gen/OWNERS b/tools/incident_section_gen/OWNERS
new file mode 100644
index 0000000..f766115
--- /dev/null
+++ b/tools/incident_section_gen/OWNERS
@@ -0,0 +1 @@
+include /cmds/incidentd/OWNERS
diff --git a/tools/powerstats/OWNERS b/tools/powerstats/OWNERS
new file mode 100644
index 0000000..d68066b
--- /dev/null
+++ b/tools/powerstats/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/power/OWNERS
diff --git a/tools/stats_log_api_gen/OWNERS b/tools/stats_log_api_gen/OWNERS
new file mode 100644
index 0000000..41a0c95
--- /dev/null
+++ b/tools/stats_log_api_gen/OWNERS
@@ -0,0 +1 @@
[email protected]
diff --git a/wifi/java/android/net/wifi/WifiConfiguration.java b/wifi/java/android/net/wifi/WifiConfiguration.java
index 85b3170..271a739 100644
--- a/wifi/java/android/net/wifi/WifiConfiguration.java
+++ b/wifi/java/android/net/wifi/WifiConfiguration.java
@@ -1638,6 +1638,11 @@
private String mConnectChoice;
/**
+ * The RSSI when the user made the connectChoice.
+ */
+ private int mConnectChoiceRssi;
+
+ /**
* Used to cache the temporary candidate during the network selection procedure. It will be
* kept updating once a new scan result has a higher score than current one
*/
@@ -1748,6 +1753,23 @@
mConnectChoice = newConnectChoice;
}
+ /**
+ * Associate a RSSI with the user connect choice network.
+ * @param rssi signal strength
+ * @hide
+ */
+ public void setConnectChoiceRssi(int rssi) {
+ mConnectChoiceRssi = rssi;
+ }
+
+ /**
+ * @return returns the RSSI of the last time the user made the connect choice.
+ * @hide
+ */
+ public int getConnectChoiceRssi() {
+ return mConnectChoiceRssi;
+ }
+
/** Get the current Quality network selection status as a String (for debugging). */
@NonNull
public String getNetworkStatusString() {
@@ -2051,6 +2073,7 @@
setCandidate(source.getCandidate());
setCandidateScore(source.getCandidateScore());
setConnectChoice(source.getConnectChoice());
+ setConnectChoiceRssi(source.getConnectChoiceRssi());
setHasEverConnected(source.hasEverConnected());
setHasNeverDetectedCaptivePortal(source.hasNeverDetectedCaptivePortal());
}
@@ -2068,6 +2091,7 @@
if (getConnectChoice() != null) {
dest.writeInt(CONNECT_CHOICE_EXISTS);
dest.writeString(getConnectChoice());
+ dest.writeInt(getConnectChoiceRssi());
} else {
dest.writeInt(CONNECT_CHOICE_NOT_EXISTS);
}
@@ -2087,6 +2111,7 @@
setNetworkSelectionBSSID(in.readString());
if (in.readInt() == CONNECT_CHOICE_EXISTS) {
setConnectChoice(in.readString());
+ setConnectChoiceRssi(in.readInt());
} else {
setConnectChoice(null);
}
@@ -2398,6 +2423,8 @@
}
if (mNetworkSelectionStatus.getConnectChoice() != null) {
sbuf.append(" connect choice: ").append(mNetworkSelectionStatus.getConnectChoice());
+ sbuf.append(" connect choice rssi: ")
+ .append(mNetworkSelectionStatus.getConnectChoiceRssi());
}
sbuf.append(" hasEverConnected: ")
.append(mNetworkSelectionStatus.hasEverConnected()).append("\n");