summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Android.bp8
-rw-r--r--api/current.txt1
-rw-r--r--cmds/app_process/Android.bp1
-rw-r--r--cmds/statsd/Android.bp2
-rw-r--r--cmds/statsd/src/atoms.proto25
-rw-r--r--cmds/statsd/src/external/StatsPullerManager.cpp3
-rw-r--r--core/java/android/app/INotificationManager.aidl2
-rw-r--r--core/java/android/app/NotificationManager.java19
-rw-r--r--core/java/android/bluetooth/BluetoothAdapter.java6
-rw-r--r--core/java/android/bluetooth/BluetoothDevice.java7
-rw-r--r--core/java/android/bluetooth/BluetoothServerSocket.java3
-rw-r--r--core/java/android/bluetooth/BluetoothSocket.java2
-rw-r--r--core/java/android/net/SocketKeepalive.java6
-rw-r--r--core/java/android/net/util/KeepaliveUtils.java8
-rw-r--r--core/java/android/service/notification/StatusBarNotification.java68
-rw-r--r--core/java/android/service/wallpaper/WallpaperService.java50
-rw-r--r--core/java/android/util/TimingsTraceLog.java25
-rw-r--r--core/java/android/view/IWindowSession.aidl26
-rw-r--r--core/java/android/view/SurfaceControl.java8
-rw-r--r--core/java/android/view/SurfaceView.java54
-rw-r--r--core/java/android/view/ViewRootImpl.java115
-rw-r--r--core/java/com/android/internal/view/BaseIWindow.java2
-rw-r--r--core/jni/android_view_SurfaceControl.cpp1
-rw-r--r--core/jni/com_android_internal_os_Zygote.cpp70
-rw-r--r--core/proto/android/app/settings_enums.proto5
-rw-r--r--core/proto/android/server/connectivity/Android.bp3
-rw-r--r--core/proto/android/server/windowmanagerservice.proto1
-rw-r--r--core/proto/android/stats/connectivity/Android.bp3
-rw-r--r--core/proto/android/stats/devicepolicy/Android.bp2
-rw-r--r--core/proto/android/stats/dnsresolver/Android.bp1
-rw-r--r--core/res/Android.bp2
-rw-r--r--core/res/res/values/config.xml2
-rw-r--r--core/tests/coretests/src/android/service/notification/StatusBarNotificationTest.java22
-rw-r--r--core/tests/coretests/src/android/util/TimingsTraceLogTest.java24
-rw-r--r--data/etc/car/com.android.car.developeroptions.xml1
-rw-r--r--data/etc/com.android.systemui.xml1
-rw-r--r--data/etc/privapp-permissions-platform.xml1
-rw-r--r--graphics/proto/Android.bp1
-rw-r--r--media/Android.bp2
-rw-r--r--media/java/android/media/ExifInterface.java4
-rw-r--r--media/proto/Android.bp1
-rw-r--r--packages/CarSystemUI/res/values/config.xml3
-rw-r--r--packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java28
-rw-r--r--packages/PackageInstaller/res/values/strings.xml7
-rw-r--r--packages/SettingsLib/Tile/src/com/android/settingslib/drawer/Tile.java8
-rw-r--r--packages/SettingsLib/Tile/src/com/android/settingslib/drawer/TileUtils.java10
-rw-r--r--packages/SystemUI/plugin/src/com/android/systemui/plugins/SensorManagerPlugin.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java28
-rw-r--r--proto/Android.bp2
-rw-r--r--proto/src/metrics_constants/metrics_constants.proto14
-rw-r--r--services/core/java/com/android/server/SystemServiceManager.java96
-rw-r--r--services/core/java/com/android/server/UiModeManagerService.java18
-rw-r--r--services/core/java/com/android/server/am/ActivityManagerService.java134
-rw-r--r--services/core/java/com/android/server/am/UserController.java22
-rw-r--r--services/core/java/com/android/server/connectivity/KeepaliveTracker.java2
-rw-r--r--services/core/java/com/android/server/locksettings/LockSettingsService.java1
-rw-r--r--services/core/java/com/android/server/notification/NotificationManagerService.java7
-rw-r--r--services/core/java/com/android/server/pm/Installer.java3
-rw-r--r--services/core/java/com/android/server/pm/PackageManagerService.java50
-rw-r--r--services/core/java/com/android/server/pm/UserManagerService.java22
-rw-r--r--services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java35
-rw-r--r--services/core/java/com/android/server/policy/PhoneWindowManager.java10
-rw-r--r--services/core/java/com/android/server/stats/StatsCompanionService.java10
-rw-r--r--services/core/java/com/android/server/utils/TimingsTraceAndSlog.java29
-rw-r--r--services/core/java/com/android/server/wm/ActivityTaskManagerService.java38
-rw-r--r--services/core/java/com/android/server/wm/AppWindowToken.java9
-rw-r--r--services/core/java/com/android/server/wm/InputMonitor.java9
-rw-r--r--services/core/java/com/android/server/wm/RecentTasks.java12
-rw-r--r--services/core/java/com/android/server/wm/Session.java6
-rw-r--r--services/core/java/com/android/server/wm/TaskSnapshotController.java12
-rw-r--r--services/core/java/com/android/server/wm/TaskSnapshotSurface.java2
-rw-r--r--services/core/java/com/android/server/wm/WindowManagerService.java7
-rw-r--r--services/core/java/com/android/server/wm/WindowStateAnimator.java27
-rw-r--r--services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java2
-rw-r--r--services/java/com/android/server/SystemServer.java40
-rw-r--r--services/net/java/android/net/NetworkStackClient.java4
-rw-r--r--telephony/java/android/telephony/SubscriptionManager.java24
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java6
-rw-r--r--telephony/java/com/android/internal/telephony/ITelephony.aidl30
-rw-r--r--tests/net/java/android/net/util/KeepaliveUtilsTest.kt1
80 files changed, 902 insertions, 456 deletions
diff --git a/Android.bp b/Android.bp
index 8fedc34fb05a..1902a5f1b3ff 100644
--- a/Android.bp
+++ b/Android.bp
@@ -747,7 +747,7 @@ java_defaults {
"core/java/android/content/pm/AndroidTestBaseUpdater.java",
],
- no_framework_libs: true,
+ sdk_version: "core_platform",
libs: [
"ext",
"updatable_media_stubs",
@@ -951,7 +951,7 @@ filegroup {
java_library {
name: "ext",
installable: true,
- no_framework_libs: true,
+ sdk_version: "core_platform",
static_libs: [
"libphonenumber-platform",
"nist-sip",
@@ -1175,7 +1175,7 @@ optional_subdirs = [
// updated to use hwbinder.stubs.
java_library {
name: "hwbinder",
- no_framework_libs: true,
+ sdk_version: "core_platform",
srcs: [
"core/java/android/os/HidlSupport.java",
@@ -1702,7 +1702,7 @@ droidstubs {
"core/java/android/util/AndroidException.java",
],
installable: false,
- no_framework_libs: true,
+ sdk_version: "core_platform",
annotations_enabled: true,
previous_api: ":last-released-public-api",
merge_annotations_dirs: [
diff --git a/api/current.txt b/api/current.txt
index 471521201b5a..28fe8bbb38d1 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -23977,6 +23977,7 @@ package android.media {
field public static final String TAG_SUBSEC_TIME_ORIGINAL = "SubSecTimeOriginal";
field public static final String TAG_THUMBNAIL_IMAGE_LENGTH = "ThumbnailImageLength";
field public static final String TAG_THUMBNAIL_IMAGE_WIDTH = "ThumbnailImageWidth";
+ field public static final String TAG_THUMBNAIL_ORIENTATION = "ThumbnailOrientation";
field public static final String TAG_TRANSFER_FUNCTION = "TransferFunction";
field public static final String TAG_USER_COMMENT = "UserComment";
field public static final String TAG_WHITE_BALANCE = "WhiteBalance";
diff --git a/cmds/app_process/Android.bp b/cmds/app_process/Android.bp
index d541169ae97a..f92502370566 100644
--- a/cmds/app_process/Android.bp
+++ b/cmds/app_process/Android.bp
@@ -21,6 +21,7 @@ cc_binary {
"libbinder",
"libcutils",
"libdl",
+ "libhidlbase",
"libhwbinder",
"liblog",
"libnativeloader",
diff --git a/cmds/statsd/Android.bp b/cmds/statsd/Android.bp
index 6bedfcdfafa3..2f0dc3cb1e98 100644
--- a/cmds/statsd/Android.bp
+++ b/cmds/statsd/Android.bp
@@ -333,7 +333,7 @@ cc_benchmark {
// ==== java proto device library (for test only) ==============================
java_library {
name: "statsdprotolite",
- no_framework_libs: true,
+ sdk_version: "core_platform",
proto: {
type: "lite",
include_dirs: ["external/protobuf/src"],
diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto
index ad0fe27f1f75..19374a58a55f 100644
--- a/cmds/statsd/src/atoms.proto
+++ b/cmds/statsd/src/atoms.proto
@@ -312,7 +312,7 @@ message Atom {
}
// Pulled events will start at field 10000.
- // Next: 10059
+ // Next: 10062
oneof pulled {
WifiBytesTransfer wifi_bytes_transfer = 10000;
WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
@@ -375,6 +375,7 @@ message Atom {
FaceSettings face_settings = 10058;
CoolingDevice cooling_device = 10059;
AppOps app_ops = 10060;
+ ProcessSystemIonHeapSize process_system_ion_heap_size = 10061;
}
// DO NOT USE field numbers above 100,000 in AOSP.
@@ -6353,6 +6354,28 @@ message SystemIonHeapSize {
optional int64 size_in_bytes = 1;
}
+/*
+ * Logs the per-process size of the system ion heap.
+ *
+ * Pulled from StatsCompanionService.
+ */
+message ProcessSystemIonHeapSize {
+ // The uid if available. -1 means not available.
+ optional int32 uid = 1 [(is_uid) = true];
+
+ // The process name (from /proc/PID/cmdline).
+ optional string process_name = 2;
+
+ // Sum of sizes of all allocations.
+ optional int32 total_size_in_kilobytes = 3;
+
+ // Number of allocations.
+ optional int32 allocation_count = 4;
+
+ // Size of the largest allocation.
+ optional int32 max_size_in_kilobytes = 5;
+}
+
/**
* Push network stack events.
*
diff --git a/cmds/statsd/src/external/StatsPullerManager.cpp b/cmds/statsd/src/external/StatsPullerManager.cpp
index 914d60d3daca..475f18a9b0b8 100644
--- a/cmds/statsd/src/external/StatsPullerManager.cpp
+++ b/cmds/statsd/src/external/StatsPullerManager.cpp
@@ -156,6 +156,9 @@ std::map<int, PullAtomInfo> StatsPullerManager::kAllPullAtomInfo = {
// system_ion_heap_size
{android::util::SYSTEM_ION_HEAP_SIZE,
{.puller = new StatsCompanionServicePuller(android::util::SYSTEM_ION_HEAP_SIZE)}},
+ // process_system_ion_heap_size
+ {android::util::PROCESS_SYSTEM_ION_HEAP_SIZE,
+ {.puller = new StatsCompanionServicePuller(android::util::PROCESS_SYSTEM_ION_HEAP_SIZE)}},
// temperature
{android::util::TEMPERATURE,
{.puller = new StatsCompanionServicePuller(android::util::TEMPERATURE)}},
diff --git a/core/java/android/app/INotificationManager.aidl b/core/java/android/app/INotificationManager.aidl
index 4db37252717e..ac8b604ad103 100644
--- a/core/java/android/app/INotificationManager.aidl
+++ b/core/java/android/app/INotificationManager.aidl
@@ -108,6 +108,8 @@ interface INotificationManager
ParceledListSlice getNotificationChannelsBypassingDnd(String pkg, int userId);
boolean isPackagePaused(String pkg);
+ void silenceNotificationSound();
+
// TODO: Remove this when callers have been migrated to the equivalent
// INotificationListener method.
@UnsupportedAppUsage
diff --git a/core/java/android/app/NotificationManager.java b/core/java/android/app/NotificationManager.java
index 2e8037509b2d..c1cee77be16d 100644
--- a/core/java/android/app/NotificationManager.java
+++ b/core/java/android/app/NotificationManager.java
@@ -1133,6 +1133,25 @@ public class NotificationManager {
}
/**
+ * Silences the current notification sound, if ones currently playing.
+ * <p>
+ * It is intended to handle use-cases such as silencing a ringing call
+ * when the user presses the volume button during ringing.
+ * <p>
+ * If this method is called prior to when the notification begins playing, the sound will not be
+ * silenced. As such it is not intended as a means to avoid playing of a sound.
+ * @hide
+ */
+ public void silenceNotificationSound() {
+ INotificationManager service = getService();
+ try {
+ service.silenceNotificationSound();
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
* Returns whether notifications from this package are temporarily hidden. This
* could be done because the package was marked as distracting to the user via
* {@code PackageManager#setDistractingPackageRestrictions(String[], int)} or because the
diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java
index 31bbd16497cb..39d63de87da3 100644
--- a/core/java/android/bluetooth/BluetoothAdapter.java
+++ b/core/java/android/bluetooth/BluetoothAdapter.java
@@ -1028,7 +1028,8 @@ public final class BluetoothAdapter {
*/
@RequiresPermission(Manifest.permission.BLUETOOTH)
@AdapterState
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(publicAlternatives = "Use {@link #getState()} instead to determine "
+ + "whether you can use BLE & BT classic.")
public int getLeState() {
int state = BluetoothAdapter.STATE_OFF;
@@ -1484,7 +1485,8 @@ public final class BluetoothAdapter {
* @return true if the scan mode was set, false otherwise
* @hide
*/
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(publicAlternatives = "Use {@link #ACTION_REQUEST_DISCOVERABLE}, which "
+ + "shows UI that confirms the user wants to go into discoverable mode.")
public boolean setScanMode(@ScanMode int mode, int duration) {
if (getState() != STATE_ON) {
return false;
diff --git a/core/java/android/bluetooth/BluetoothDevice.java b/core/java/android/bluetooth/BluetoothDevice.java
index 388161d76308..c6160446c798 100644
--- a/core/java/android/bluetooth/BluetoothDevice.java
+++ b/core/java/android/bluetooth/BluetoothDevice.java
@@ -1051,7 +1051,7 @@ public final class BluetoothDevice implements Parcelable {
* @return the Bluetooth alias, or null if no alias or there was a problem
* @hide
*/
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(publicAlternatives = "Use {@link #getName()} instead.")
public String getAlias() {
final IBluetooth service = sService;
if (service == null) {
@@ -1100,7 +1100,7 @@ public final class BluetoothDevice implements Parcelable {
* @see #getAlias()
* @see #getName()
*/
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(publicAlternatives = "Use {@link #getName()} instead.")
public String getAliasName() {
String name = getAlias();
if (name == null) {
@@ -1975,7 +1975,8 @@ public final class BluetoothDevice implements Parcelable {
* permissions.
* @hide
*/
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(publicAlternatives = "Use "
+ + "{@link #createInsecureRfcommSocketToServiceRecord} instead.")
public BluetoothSocket createInsecureRfcommSocket(int port) throws IOException {
if (!isBluetoothEnabled()) {
Log.e(TAG, "Bluetooth is not enabled");
diff --git a/core/java/android/bluetooth/BluetoothServerSocket.java b/core/java/android/bluetooth/BluetoothServerSocket.java
index c06b837a9ee3..3a23808f3617 100644
--- a/core/java/android/bluetooth/BluetoothServerSocket.java
+++ b/core/java/android/bluetooth/BluetoothServerSocket.java
@@ -77,7 +77,8 @@ public final class BluetoothServerSocket implements Closeable {
private static final String TAG = "BluetoothServerSocket";
private static final boolean DBG = false;
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(publicAlternatives = "Use public {@link BluetoothServerSocket} API "
+ + "instead.")
/*package*/ final BluetoothSocket mSocket;
private Handler mHandler;
private int mMessage;
diff --git a/core/java/android/bluetooth/BluetoothSocket.java b/core/java/android/bluetooth/BluetoothSocket.java
index 3a1e2f58c99d..a6e3153d6af7 100644
--- a/core/java/android/bluetooth/BluetoothSocket.java
+++ b/core/java/android/bluetooth/BluetoothSocket.java
@@ -131,7 +131,7 @@ public final class BluetoothSocket implements Closeable {
private boolean mExcludeSdp = false; /* when true no SPP SDP record will be created */
private boolean mAuthMitm = false; /* when true Man-in-the-middle protection will be enabled*/
private boolean mMin16DigitPin = false; /* Minimum 16 digit pin for sec mode 2 connections */
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(publicAlternatives = "Use {@link BluetoothSocket} public API instead.")
private ParcelFileDescriptor mPfd;
@UnsupportedAppUsage
private LocalSocket mSocket;
diff --git a/core/java/android/net/SocketKeepalive.java b/core/java/android/net/SocketKeepalive.java
index 46eddde968a0..ec73866a647d 100644
--- a/core/java/android/net/SocketKeepalive.java
+++ b/core/java/android/net/SocketKeepalive.java
@@ -44,9 +44,11 @@ import java.util.concurrent.Executor;
* {@link SocketKeepalive.Callback#onStopped} if the operation was successful or
* {@link SocketKeepalive.Callback#onError} if an error occurred.
*
- * The device SHOULD support keepalive offload. If it does not, it MUST reply with
+ * For cellular, the device MUST support at least 1 keepalive slot.
+ *
+ * For WiFi, the device SHOULD support keepalive offload. If it does not, it MUST reply with
* {@link SocketKeepalive.Callback#onError} with {@code ERROR_UNSUPPORTED} to any keepalive offload
- * request. If it does, it MUST support at least 3 concurrent keepalive slots per transport.
+ * request. If it does, it MUST support at least 3 concurrent keepalive slots.
*/
public abstract class SocketKeepalive implements AutoCloseable {
static final String TAG = "SocketKeepalive";
diff --git a/core/java/android/net/util/KeepaliveUtils.java b/core/java/android/net/util/KeepaliveUtils.java
index 569fed1fc994..bfc4563fbf8f 100644
--- a/core/java/android/net/util/KeepaliveUtils.java
+++ b/core/java/android/net/util/KeepaliveUtils.java
@@ -34,9 +34,6 @@ public final class KeepaliveUtils {
public static final String TAG = "KeepaliveUtils";
- // Minimum supported keepalive count per transport if the network supports keepalive.
- public static final int MIN_SUPPORTED_KEEPALIVE_COUNT = 3;
-
public static class KeepaliveDeviceConfigurationException extends AndroidRuntimeException {
public KeepaliveDeviceConfigurationException(final String msg) {
super(msg);
@@ -84,10 +81,7 @@ public final class KeepaliveUtils {
throw new KeepaliveDeviceConfigurationException("Invalid transport " + transport);
}
- // Customized values should be either 0 to indicate the network doesn't support
- // keepalive offload, or a positive value that is at least
- // MIN_SUPPORTED_KEEPALIVE_COUNT if supported.
- if (supported != 0 && supported < MIN_SUPPORTED_KEEPALIVE_COUNT) {
+ if (supported < 0) {
throw new KeepaliveDeviceConfigurationException(
"Invalid supported count " + supported + " for "
+ NetworkCapabilities.transportNameOf(transport));
diff --git a/core/java/android/service/notification/StatusBarNotification.java b/core/java/android/service/notification/StatusBarNotification.java
index 8512a0bd8088..905c7811e457 100644
--- a/core/java/android/service/notification/StatusBarNotification.java
+++ b/core/java/android/service/notification/StatusBarNotification.java
@@ -20,6 +20,7 @@ import android.annotation.NonNull;
import android.annotation.UnsupportedAppUsage;
import android.app.Notification;
import android.app.NotificationManager;
+import android.app.Person;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
@@ -32,6 +33,8 @@ import android.os.UserHandle;
import com.android.internal.logging.nano.MetricsProto;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
+import java.util.ArrayList;
+
/**
* Class encapsulating a Notification. Sent by the NotificationManagerService to clients including
* the status bar and any {@link android.service.notification.NotificationListenerService}s.
@@ -166,6 +169,7 @@ public class StatusBarNotification implements Parcelable {
/**
* Returns true if application asked that this notification be part of a group.
+ *
* @hide
*/
public boolean isAppGroup() {
@@ -203,18 +207,16 @@ public class StatusBarNotification implements Parcelable {
return 0;
}
- public static final @android.annotation.NonNull Parcelable.Creator<StatusBarNotification> CREATOR
- = new Parcelable.Creator<StatusBarNotification>()
- {
- public StatusBarNotification createFromParcel(Parcel parcel)
- {
- return new StatusBarNotification(parcel);
- }
+ public static final @android.annotation.NonNull
+ Parcelable.Creator<StatusBarNotification> CREATOR =
+ new Parcelable.Creator<StatusBarNotification>() {
+ public StatusBarNotification createFromParcel(Parcel parcel) {
+ return new StatusBarNotification(parcel);
+ }
- public StatusBarNotification[] newArray(int size)
- {
- return new StatusBarNotification[size];
- }
+ public StatusBarNotification[] newArray(int size) {
+ return new StatusBarNotification[size];
+ }
};
/**
@@ -243,14 +245,16 @@ public class StatusBarNotification implements Parcelable {
this.key, this.notification);
}
- /** Convenience method to check the notification's flags for
+ /**
+ * Convenience method to check the notification's flags for
* {@link Notification#FLAG_ONGOING_EVENT}.
*/
public boolean isOngoing() {
return (notification.flags & Notification.FLAG_ONGOING_EVENT) != 0;
}
- /** Convenience method to check the notification's flags for
+ /**
+ * Convenience method to check the notification's flags for
* either {@link Notification#FLAG_ONGOING_EVENT} or
* {@link Notification#FLAG_NO_CLEAR}.
*/
@@ -274,13 +278,15 @@ public class StatusBarNotification implements Parcelable {
return pkg;
}
- /** The id supplied to {@link android.app.NotificationManager#notify(int,Notification)}. */
+ /** The id supplied to {@link android.app.NotificationManager#notify(int, Notification)}. */
public int getId() {
return id;
}
- /** The tag supplied to {@link android.app.NotificationManager#notify(int,Notification)},
- * or null if no tag was specified. */
+ /**
+ * The tag supplied to {@link android.app.NotificationManager#notify(int, Notification)},
+ * or null if no tag was specified.
+ */
public String getTag() {
return tag;
}
@@ -307,8 +313,10 @@ public class StatusBarNotification implements Parcelable {
return initialPid;
}
- /** The {@link android.app.Notification} supplied to
- * {@link android.app.NotificationManager#notify(int,Notification)}. */
+ /**
+ * The {@link android.app.Notification} supplied to
+ * {@link android.app.NotificationManager#notify(int, Notification)}.
+ */
public Notification getNotification() {
return notification;
}
@@ -320,7 +328,8 @@ public class StatusBarNotification implements Parcelable {
return user;
}
- /** The time (in {@link System#currentTimeMillis} time) the notification was posted,
+ /**
+ * The time (in {@link System#currentTimeMillis} time) the notification was posted,
* which may be different than {@link android.app.Notification#when}.
*/
public long getPostTime() {
@@ -343,6 +352,7 @@ public class StatusBarNotification implements Parcelable {
/**
* The ID passed to setGroup(), or the override, or null.
+ *
* @hide
*/
public String getGroup() {
@@ -398,10 +408,11 @@ public class StatusBarNotification implements Parcelable {
/**
* Returns a LogMaker that contains all basic information of the notification.
+ *
* @hide
*/
public LogMaker getLogMaker() {
- return new LogMaker(MetricsEvent.VIEW_UNKNOWN).setPackageName(getPackageName())
+ LogMaker logMaker = new LogMaker(MetricsEvent.VIEW_UNKNOWN).setPackageName(getPackageName())
.addTaggedData(MetricsEvent.NOTIFICATION_ID, getId())
.addTaggedData(MetricsEvent.NOTIFICATION_TAG, getTag())
.addTaggedData(MetricsEvent.FIELD_NOTIFICATION_CHANNEL_ID, getChannelIdLogTag())
@@ -410,6 +421,21 @@ public class StatusBarNotification implements Parcelable {
getNotification().isGroupSummary() ? 1 : 0)
.addTaggedData(MetricsProto.MetricsEvent.FIELD_NOTIFICATION_CATEGORY,
getNotification().category);
+ if (getNotification().extras != null) {
+ // Log the style used, if present. We only log the hash here, as notification log
+ // events are frequent, while there are few styles (hence low chance of collisions).
+ String template = getNotification().extras.getString(Notification.EXTRA_TEMPLATE);
+ if (template != null && !template.isEmpty()) {
+ logMaker.addTaggedData(MetricsEvent.FIELD_NOTIFICATION_STYLE,
+ template.hashCode());
+ }
+ ArrayList<Person> people = getNotification().extras.getParcelableArrayList(
+ Notification.EXTRA_PEOPLE_LIST);
+ if (people != null && !people.isEmpty()) {
+ logMaker.addTaggedData(MetricsEvent.FIELD_NOTIFICATION_PEOPLE, people.size());
+ }
+ }
+ return logMaker;
}
private String getGroupLogTag() {
@@ -433,6 +459,6 @@ public class StatusBarNotification implements Parcelable {
}
String hash = Integer.toHexString(logTag.hashCode());
return logTag.substring(0, MAX_LOG_TAG_LENGTH - hash.length() - 1) + "-"
- + hash;
+ + hash;
}
}
diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java
index d645e3f746d7..60dbf84d555c 100644
--- a/core/java/android/service/wallpaper/WallpaperService.java
+++ b/core/java/android/service/wallpaper/WallpaperService.java
@@ -105,7 +105,7 @@ public abstract class WallpaperService extends Service {
static final String TAG = "WallpaperService";
static final boolean DEBUG = false;
-
+
private static final int DO_ATTACH = 10;
private static final int DO_DETACH = 20;
private static final int DO_SET_DESIRED_SIZE = 30;
@@ -126,7 +126,7 @@ public abstract class WallpaperService extends Service {
private final ArrayList<Engine> mActiveEngines
= new ArrayList<Engine>();
-
+
static final class WallpaperCommand {
String action;
int x;
@@ -145,7 +145,7 @@ public abstract class WallpaperService extends Service {
*/
public class Engine {
IWallpaperEngineWrapper mIWallpaperEngine;
-
+
// Copies from mIWallpaperEngine.
HandlerCaller mCaller;
IWallpaperConnection mConnection;
@@ -155,7 +155,7 @@ public abstract class WallpaperService extends Service {
boolean mVisible;
boolean mReportedVisible;
boolean mDestroyed;
-
+
// Current window state.
boolean mCreated;
boolean mSurfaceCreated;
@@ -258,7 +258,7 @@ public abstract class WallpaperService extends Service {
}
super.setFixedSize(width, height);
}
-
+
public void setKeepScreenOn(boolean screenOn) {
throw new UnsupportedOperationException(
"Wallpapers do not support keep screen on");
@@ -403,14 +403,14 @@ public abstract class WallpaperService extends Service {
mClockFunction = clockFunction;
mHandler = handler;
}
-
+
/**
* Provides access to the surface in which this wallpaper is drawn.
*/
public SurfaceHolder getSurfaceHolder() {
return mSurfaceHolder;
}
-
+
/**
* Convenience for {@link WallpaperManager#getDesiredMinimumWidth()
* WallpaperManager.getDesiredMinimumWidth()}, returning the width
@@ -419,7 +419,7 @@ public abstract class WallpaperService extends Service {
public int getDesiredMinimumWidth() {
return mIWallpaperEngine.mReqWidth;
}
-
+
/**
* Convenience for {@link WallpaperManager#getDesiredMinimumHeight()
* WallpaperManager.getDesiredMinimumHeight()}, returning the height
@@ -437,7 +437,7 @@ public abstract class WallpaperService extends Service {
public boolean isVisible() {
return mReportedVisible;
}
-
+
/**
* Returns true if this engine is running in preview mode -- that is,
* it is being shown to the user before they select it as the actual
@@ -456,7 +456,7 @@ public abstract class WallpaperService extends Service {
public boolean isInAmbientMode() {
return mIsInAmbientMode;
}
-
+
/**
* Control whether this wallpaper will receive raw touch events
* from the window manager as the user interacts with the window
@@ -557,7 +557,7 @@ public abstract class WallpaperService extends Service {
* {@link WallpaperManager#sendWallpaperCommand}.
* The default implementation does nothing, and always returns null
* as the result.
- *
+ *
* @param action The name of the command to perform. This tells you
* what to do and how to interpret the rest of the arguments.
* @param x Generic integer parameter.
@@ -794,7 +794,7 @@ public abstract class WallpaperService extends Service {
}
mLayout.format = mFormat;
-
+
mCurWindowFlags = mWindowFlags;
mLayout.flags = mWindowFlags
| WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
@@ -1020,7 +1020,7 @@ public abstract class WallpaperService extends Service {
mIsCreating = false;
mSurfaceCreated = true;
if (redrawNeeded) {
- mSession.finishDrawing(mWindow);
+ mSession.finishDrawing(mWindow, null /* postDrawTransaction */);
}
mIWallpaperEngine.reportShown();
}
@@ -1045,7 +1045,7 @@ public abstract class WallpaperService extends Service {
mSurfaceHolder.setSizeFromLayout();
mInitializing = true;
mSession = WindowManagerGlobal.getWindowSession();
-
+
mWindow.setSession(mSession);
mLayout.packageName = getPackageName();
@@ -1149,7 +1149,7 @@ public abstract class WallpaperService extends Service {
}
}
}
-
+
void doOffsetsChanged(boolean always) {
if (mDestroyed) {
return;
@@ -1187,7 +1187,7 @@ public abstract class WallpaperService extends Service {
mOffsetsChanged = true;
}
}
-
+
if (sync) {
try {
if (DEBUG) Log.v(TAG, "Reporting offsets change complete");
@@ -1196,7 +1196,7 @@ public abstract class WallpaperService extends Service {
}
}
}
-
+
void doCommand(WallpaperCommand cmd) {
Bundle result;
if (!mDestroyed) {
@@ -1213,7 +1213,7 @@ public abstract class WallpaperService extends Service {
}
}
}
-
+
void reportSurfaceDestroyed() {
if (mSurfaceCreated) {
mSurfaceCreated = false;
@@ -1229,12 +1229,12 @@ public abstract class WallpaperService extends Service {
onSurfaceDestroyed(mSurfaceHolder);
}
}
-
+
void detach() {
if (mDestroyed) {
return;
}
-
+
mDestroyed = true;
if (mIWallpaperEngine.mDisplayManager != null) {
@@ -1246,9 +1246,9 @@ public abstract class WallpaperService extends Service {
if (DEBUG) Log.v(TAG, "onVisibilityChanged(false): " + this);
onVisibilityChanged(false);
}
-
+
reportSurfaceDestroyed();
-
+
if (DEBUG) Log.v(TAG, "onDestroy(): " + this);
onDestroy();
@@ -1256,18 +1256,18 @@ public abstract class WallpaperService extends Service {
try {
if (DEBUG) Log.v(TAG, "Removing window and destroying surface "
+ mSurfaceHolder.getSurface() + " of: " + this);
-
+
if (mInputEventReceiver != null) {
mInputEventReceiver.dispose();
mInputEventReceiver = null;
}
-
+
mSession.remove(mWindow);
} catch (RemoteException e) {
}
mSurfaceHolder.mSurface.release();
mCreated = false;
-
+
// Dispose the input channel after removing the window so the Window Manager
// doesn't interpret the input channel being closed as an abnormal termination.
if (mInputChannel != null) {
diff --git a/core/java/android/util/TimingsTraceLog.java b/core/java/android/util/TimingsTraceLog.java
index 3e6f09bfa799..bc2172297f83 100644
--- a/core/java/android/util/TimingsTraceLog.java
+++ b/core/java/android/util/TimingsTraceLog.java
@@ -16,16 +16,22 @@
package android.util;
+import android.annotation.NonNull;
import android.os.Build;
import android.os.SystemClock;
import android.os.Trace;
import java.util.ArrayDeque;
+import java.util.ArrayList;
+import java.util.Collections;
import java.util.Deque;
+import java.util.List;
/**
* Helper class for reporting boot and shutdown timing metrics.
- * <p>Note: This class is not thread-safe. Use a separate copy for other threads</p>
+ *
+ * <p><b>NOTE:</b> This class is not thread-safe. Use a separate copy for other threads.
+ *
* @hide
*/
public class TimingsTraceLog {
@@ -88,4 +94,21 @@ public class TimingsTraceLog {
public void logDuration(String name, long timeMs) {
Slog.d(mTag, name + " took to complete: " + timeMs + "ms");
}
+
+ /**
+ * Gets the names of the traces that {@link #traceBegin(String) have begun} but
+ * {@link #traceEnd() have not finished} yet.
+ *
+ * <p><b>NOTE:</b> this method is expensive and it should not be used in "production" - it
+ * should only be used for debugging purposes during development (and/or guarded by
+ * static {@code DEBUG} constants that are {@code false}).
+ */
+ @NonNull
+ public final List<String> getUnfinishedTracesForDebug() {
+ if (mStartTimes == null || mStartTimes.isEmpty()) return Collections.emptyList();
+
+ final ArrayList<String> stack = new ArrayList<>(mStartTimes.size());
+ mStartTimes.descendingIterator().forEachRemaining((pair) -> stack.add(pair.first));
+ return stack;
+ }
}
diff --git a/core/java/android/view/IWindowSession.aidl b/core/java/android/view/IWindowSession.aidl
index caab00c3863e..37b6f1317fbf 100644
--- a/core/java/android/view/IWindowSession.aidl
+++ b/core/java/android/view/IWindowSession.aidl
@@ -2,15 +2,15 @@
**
** Copyright 2006, 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
+** 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
+** 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.
+** 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.
*/
@@ -31,6 +31,7 @@ import android.view.WindowManager;
import android.view.InsetsState;
import android.view.Surface;
import android.view.SurfaceControl;
+import android.view.Transaction;
import java.util.List;
@@ -57,7 +58,7 @@ interface IWindowSession {
* position should be ignored) and surface of the window. The surface
* will be invalid if the window is currently hidden, else you can use it
* to draw the window's contents.
- *
+ *
* @param window The window being modified.
* @param seq Ordering sequence number.
* @param attrs If non-null, new attributes to apply to the window.
@@ -147,8 +148,15 @@ interface IWindowSession {
*/
void getDisplayFrame(IWindow window, out Rect outDisplayFrame);
+ /**
+ * Called when the client has finished drawing the surface, if needed.
+ *
+ * @param postDrawTransaction transaction filled by the client that can be
+ * used to synchronize any post draw transactions with the server. Transaction
+ * is null if there is no sync required.
+ */
@UnsupportedAppUsage
- void finishDrawing(IWindow window);
+ void finishDrawing(IWindow window, in Transaction postDrawTransaction);
@UnsupportedAppUsage
void setInTouchMode(boolean showFocus);
diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java
index bb169e01bbac..c1633ae507ad 100644
--- a/core/java/android/view/SurfaceControl.java
+++ b/core/java/android/view/SurfaceControl.java
@@ -2693,6 +2693,14 @@ public final class SurfaceControl implements Parcelable {
return this;
}
+ /**
+ * Writes the transaction to parcel, clearing the transaction as if it had been applied so
+ * it can be used to store future transactions. It's the responsibility of the parcel
+ * reader to apply the original transaction.
+ *
+ * @param dest parcel to write the transaction to
+ * @param flags
+ */
@Override
public void writeToParcel(@NonNull Parcel dest, @WriteFlags int flags) {
if (mNativeObject == 0) {
diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java
index 353544779086..4891b43c829e 100644
--- a/core/java/android/view/SurfaceView.java
+++ b/core/java/android/view/SurfaceView.java
@@ -98,7 +98,8 @@ import java.util.concurrent.locks.ReentrantLock;
* artifacts may occur on previous versions of the platform when its window is
* positioned asynchronously.</p>
*/
-public class SurfaceView extends View implements ViewRootImpl.WindowStoppedCallback {
+public class SurfaceView extends View
+ implements ViewRootImpl.WindowStoppedCallback, ViewRootImpl.SurfaceChangedCallback {
private static final String TAG = "SurfaceView";
private static final boolean DEBUG = false;
@@ -120,7 +121,7 @@ public class SurfaceView extends View implements ViewRootImpl.WindowStoppedCallb
boolean mDrawFinished = false;
final Rect mScreenRect = new Rect();
- SurfaceSession mSurfaceSession;
+ final SurfaceSession mSurfaceSession = new SurfaceSession();
SurfaceControl mSurfaceControl;
// In the case of format changes we switch out the surface in-place
@@ -266,11 +267,22 @@ public class SurfaceView extends View implements ViewRootImpl.WindowStoppedCallb
updateSurface();
}
+ /** @hide */
+ @Override
+ public void surfaceChangedCallback(SurfaceControl.Transaction transaction) {
+ if (getViewRootImpl() != null && mBackgroundControl != null && mSurfaceControl != null) {
+ SurfaceControl sc = getViewRootImpl().getSurfaceControl();
+ transaction.setRelativeLayer(mBackgroundControl, sc, Integer.MIN_VALUE);
+ transaction.setRelativeLayer(mSurfaceControl, sc, mSubLayer);
+ }
+ }
+
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
getViewRootImpl().addWindowStoppedCallback(this);
+ getViewRootImpl().addSurfaceChangedCallback(this);
mWindowStopped = false;
mViewVisibility = getVisibility() == VISIBLE;
@@ -356,6 +368,7 @@ public class SurfaceView extends View implements ViewRootImpl.WindowStoppedCallb
// the SurfaceHolder forward, most live wallpapers do it.
if (viewRoot != null) {
viewRoot.removeWindowStoppedCallback(this);
+ viewRoot.removeSurfaceChangedCallback(this);
}
mAttachedToWindow = false;
@@ -637,21 +650,34 @@ public class SurfaceView extends View implements ViewRootImpl.WindowStoppedCallb
mScreenRect.offset(surfaceInsets.left, surfaceInsets.top);
if (creating) {
- viewRoot.createBoundsSurface(mSubLayer);
- mSurfaceSession = new SurfaceSession();
mDeferredDestroySurfaceControl = mSurfaceControl;
updateOpaqueFlag();
+ // SurfaceView hierarchy
+ // ViewRootImpl surface
+ // - bounds layer (crops all child surfaces to parent surface insets)
+ // - SurfaceView surface (drawn relative to ViewRootImpl surface)
+ // - Background color layer (drawn behind all SurfaceView surfaces)
+ //
+ // The bounds layer is used to crop the surface view so it does not draw into
+ // the parent surface inset region. Since there can be multiple surface views
+ // below or above the parent surface, one option is to create multiple bounds
+ // layer for each z order. The other option, the one implement is to create
+ // a single bounds layer and set z order for each child surface relative to the
+ // parent surface.
+ // When creating the surface view, we parent it to the bounds layer and then
+ // set the relative z order. When the parent surface changes, we have to
+ // make sure to update the relative z via ViewRootImpl.SurfaceChangedCallback.
final String name = "SurfaceView - " + viewRoot.getTitle().toString();
-
- mSurfaceControl = new SurfaceControl.Builder(mSurfaceSession)
- .setName(name)
- .setOpaque((mSurfaceFlags & SurfaceControl.OPAQUE) != 0)
- .setBufferSize(mSurfaceWidth, mSurfaceHeight)
- .setFormat(mFormat)
- .setParent(viewRoot.getSurfaceControl())
- .setFlags(mSurfaceFlags)
- .build();
+ mSurfaceControl =
+ new SurfaceControl.Builder(mSurfaceSession)
+ .setName(name)
+ .setOpaque((mSurfaceFlags & SurfaceControl.OPAQUE) != 0)
+ .setBufferSize(mSurfaceWidth, mSurfaceHeight)
+ .setFormat(mFormat)
+ .setParent(viewRoot.getBoundsLayer())
+ .setFlags(mSurfaceFlags)
+ .build();
mBackgroundControl = new SurfaceControl.Builder(mSurfaceSession)
.setName("Background for -" + name)
.setOpaque(true)
@@ -674,7 +700,7 @@ public class SurfaceView extends View implements ViewRootImpl.WindowStoppedCallb
SurfaceControl.openTransaction();
try {
- mSurfaceControl.setLayer(mSubLayer);
+ mSurfaceControl.setRelativeLayer(viewRoot.getSurfaceControl(), mSubLayer);
if (mViewVisibility) {
mSurfaceControl.show();
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 30bb2bbd3385..16de906b1085 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -68,6 +68,7 @@ import android.os.Build;
import android.os.Bundle;
import android.os.Debug;
import android.os.Handler;
+import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.os.ParcelFileDescriptor;
@@ -476,17 +477,19 @@ public final class ViewRootImpl implements ViewParent,
@UnsupportedAppUsage
public final Surface mSurface = new Surface();
private final SurfaceControl mSurfaceControl = new SurfaceControl();
+ private IBinder mPreviousSurfaceControlHandle = null;
+
+ private final Transaction mChangeSurfaceTransaction = new Transaction();
+ private final SurfaceSession mSurfaceSession = new SurfaceSession();
/**
- * Child surface of {@code mSurface} with the same bounds as its parent, and crop bounds
- * are set to the parent's bounds adjusted for surface insets. This surface is created when
- * {@link ViewRootImpl#createBoundsSurface(int)} is called.
- * By parenting to this bounds surface, child surfaces can ensure they do not draw into the
- * surface inset regions set by the parent window.
+ * Child container layer of {@code mSurface} with the same bounds as its parent, and cropped to
+ * the surface insets. This surface is created only if a client requests it via {@link
+ * #getBoundsLayer()}. By parenting to this bounds surface, child surfaces can ensure they do
+ * not draw into the surface inset regions set by the parent window.
*/
- public final Surface mBoundsSurface = new Surface();
- private SurfaceSession mSurfaceSession;
- private SurfaceControl mBoundsSurfaceControl;
+ private SurfaceControl mBoundsLayer;
+
private final Transaction mTransaction = new Transaction();
@UnsupportedAppUsage
@@ -1576,65 +1579,76 @@ public final class ViewRootImpl implements ViewParent,
}
}
- /**
- * Creates a surface as a child of {@code mSurface} with the same bounds as its parent and
- * crop bounds set to the parent's bounds adjusted for surface insets.
- *
- * @param zOrderLayer Z order relative to the parent surface.
- */
- public void createBoundsSurface(int zOrderLayer) {
- if (mSurfaceSession == null) {
- mSurfaceSession = new SurfaceSession();
- }
- if (mBoundsSurfaceControl != null && mBoundsSurface.isValid()) {
- return; // surface control for bounds surface already exists.
+ /** Register callback to be notified when the ViewRootImpl surface changes. */
+ interface SurfaceChangedCallback {
+ void surfaceChangedCallback(SurfaceControl.Transaction transaction);
+ }
+
+ private final ArrayList<SurfaceChangedCallback> mSurfaceChangedCallbacks = new ArrayList<>();
+ void addSurfaceChangedCallback(SurfaceChangedCallback c) {
+ mSurfaceChangedCallbacks.add(c);
+ }
+
+ void removeSurfaceChangedCallback(SurfaceChangedCallback c) {
+ mSurfaceChangedCallbacks.remove(c);
+ }
+
+ private void notifySurfaceChanged(SurfaceControl.Transaction transaction) {
+ for (int i = 0; i < mSurfaceChangedCallbacks.size(); i++) {
+ mSurfaceChangedCallbacks.get(i).surfaceChangedCallback(transaction);
}
+ }
- mBoundsSurfaceControl = new SurfaceControl.Builder(mSurfaceSession)
+ /**
+ * Returns a child layer with the same bounds as its parent {@code mSurface} and cropped to the
+ * surface insets. If the layer does not exist, it is created.
+ *
+ * <p>Parenting to this layer will ensure that its children are cropped by the view's surface
+ * insets.
+ */
+ public SurfaceControl getBoundsLayer() {
+ if (mBoundsLayer == null) {
+ mBoundsLayer = new SurfaceControl.Builder(mSurfaceSession)
+ .setContainerLayer()
.setName("Bounds for - " + getTitle().toString())
.setParent(mSurfaceControl)
.build();
- setBoundsSurfaceCrop();
- mTransaction.setLayer(mBoundsSurfaceControl, zOrderLayer)
- .show(mBoundsSurfaceControl)
- .apply();
- mBoundsSurface.copyFrom(mBoundsSurfaceControl);
+ setBoundsLayerCrop(mTransaction);
+ mTransaction.show(mBoundsLayer).apply();
+ }
+ return mBoundsLayer;
}
- private void setBoundsSurfaceCrop() {
+ private void setBoundsLayerCrop(Transaction t) {
// mWinFrame is already adjusted for surface insets. So offset it and use it as
// the cropping bounds.
mTempBoundsRect.set(mWinFrame);
mTempBoundsRect.offsetTo(mWindowAttributes.surfaceInsets.left,
mWindowAttributes.surfaceInsets.top);
- mTransaction.setWindowCrop(mBoundsSurfaceControl, mTempBoundsRect);
+ t.setWindowCrop(mBoundsLayer, mTempBoundsRect);
}
/**
- * Called after window layout to update the bounds surface. If the surface insets have
- * changed or the surface has resized, update the bounds surface.
+ * Called after window layout to update the bounds surface. If the surface insets have changed
+ * or the surface has resized, update the bounds surface.
*/
- private void updateBoundsSurface() {
- if (mBoundsSurfaceControl != null && mSurface.isValid()) {
- setBoundsSurfaceCrop();
- mTransaction.deferTransactionUntilSurface(mBoundsSurfaceControl,
+ private void updateBoundsLayer() {
+ if (mBoundsLayer != null) {
+ setBoundsLayerCrop(mTransaction);
+ mTransaction.deferTransactionUntilSurface(mBoundsLayer,
mSurface, mSurface.getNextFrameNumber())
.apply();
}
}
private void destroySurface() {
+ if (mBoundsLayer != null) {
+ mBoundsLayer.release();
+ mBoundsLayer = null;
+ }
mSurface.release();
mSurfaceControl.release();
-
- mSurfaceSession = null;
-
- if (mBoundsSurfaceControl != null) {
- mBoundsSurfaceControl.remove();
- mBoundsSurface.release();
- mBoundsSurfaceControl = null;
- }
}
/**
@@ -2598,7 +2612,7 @@ public final class ViewRootImpl implements ViewParent,
}
if (surfaceSizeChanged) {
- updateBoundsSurface();
+ updateBoundsLayer();
}
final boolean didLayout = layoutRequested && (!mStopped || mReportNextDraw);
@@ -3438,7 +3452,9 @@ public final class ViewRootImpl implements ViewParent,
private void reportDrawFinished() {
try {
mDrawsNeededToReport = 0;
- mWindowSession.finishDrawing(mWindow);
+ if (mSurfaceControl.isValid()) {
+ mWindowSession.finishDrawing(mWindow, mChangeSurfaceTransaction);
+ }
} catch (RemoteException e) {
// Have fun!
}
@@ -7089,6 +7105,9 @@ public final class ViewRootImpl implements ViewParent,
frameNumber = mSurface.getNextFrameNumber();
}
+ mPreviousSurfaceControlHandle = mSurfaceControl.isValid()
+ ? mSurfaceControl.getHandle() : null;
+
int relayoutResult = mWindowSession.relayout(mWindow, mSeq, params,
(int) (mView.getMeasuredWidth() * appScale + 0.5f),
(int) (mView.getMeasuredHeight() * appScale + 0.5f), viewVisibility,
@@ -7102,6 +7121,11 @@ public final class ViewRootImpl implements ViewParent,
destroySurface();
}
+ if (mPreviousSurfaceControlHandle != null && mSurfaceControl.isValid()
+ && mPreviousSurfaceControlHandle != mSurfaceControl.getHandle()) {
+ notifySurfaceChanged(mChangeSurfaceTransaction);
+ }
+
mPendingAlwaysConsumeSystemBars =
(relayoutResult & WindowManagerGlobal.RELAYOUT_RES_CONSUME_ALWAYS_SYSTEM_BARS) != 0;
@@ -7326,7 +7350,8 @@ public final class ViewRootImpl implements ViewParent,
try {
if ((relayoutWindow(mWindowAttributes, viewVisibility, false)
& WindowManagerGlobal.RELAYOUT_RES_FIRST_TIME) != 0) {
- mWindowSession.finishDrawing(mWindow);
+ mWindowSession.finishDrawing(
+ mWindow, null /* postDrawTransaction */);
}
} catch (RemoteException e) {
}
diff --git a/core/java/com/android/internal/view/BaseIWindow.java b/core/java/com/android/internal/view/BaseIWindow.java
index f9cdf3d0be61..dfd6f95c00af 100644
--- a/core/java/com/android/internal/view/BaseIWindow.java
+++ b/core/java/com/android/internal/view/BaseIWindow.java
@@ -49,7 +49,7 @@ public class BaseIWindow extends IWindow.Stub {
DisplayCutout.ParcelableWrapper displayCutout) {
if (reportDraw) {
try {
- mSession.finishDrawing(this);
+ mSession.finishDrawing(this, null /* postDrawTransaction */);
} catch (RemoteException e) {
}
}
diff --git a/core/jni/android_view_SurfaceControl.cpp b/core/jni/android_view_SurfaceControl.cpp
index f55f81de68f3..f55077a65309 100644
--- a/core/jni/android_view_SurfaceControl.cpp
+++ b/core/jni/android_view_SurfaceControl.cpp
@@ -1266,6 +1266,7 @@ static void nativeWriteTransactionToParcel(JNIEnv* env, jclass clazz, jlong nati
reinterpret_cast<SurfaceComposerClient::Transaction *>(nativeObject);
if (self != nullptr) {
self->writeToParcel(parcel);
+ self->clear();
}
}
diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp
index 0cd3dbffa007..834dd03de7e9 100644
--- a/core/jni/com_android_internal_os_Zygote.cpp
+++ b/core/jni/com_android_internal_os_Zygote.cpp
@@ -292,6 +292,7 @@ static std::array<UsapTableEntry, USAP_POOL_SIZE_MAX_LIMIT> gUsapTable;
static FileDescriptorTable* gOpenFdTable = nullptr;
// Must match values in com.android.internal.os.Zygote.
+// The order of entries here must be kept in sync with ExternalStorageViews array values.
enum MountExternalKind {
MOUNT_EXTERNAL_NONE = 0,
MOUNT_EXTERNAL_DEFAULT = 1,
@@ -300,6 +301,18 @@ enum MountExternalKind {
MOUNT_EXTERNAL_LEGACY = 4,
MOUNT_EXTERNAL_INSTALLER = 5,
MOUNT_EXTERNAL_FULL = 6,
+ MOUNT_EXTERNAL_COUNT = 7
+};
+
+// The order of entries here must be kept in sync with MountExternalKind enum values.
+static const std::array<const std::string, MOUNT_EXTERNAL_COUNT> ExternalStorageViews = {
+ "", // MOUNT_EXTERNAL_NONE
+ "/mnt/runtime/default", // MOUNT_EXTERNAL_DEFAULT
+ "/mnt/runtime/read", // MOUNT_EXTERNAL_READ
+ "/mnt/runtime/write", // MOUNT_EXTERNAL_WRITE
+ "/mnt/runtime/write", // MOUNT_EXTERNAL_LEGACY
+ "/mnt/runtime/write", // MOUNT_EXTERNAL_INSTALLER
+ "/mnt/runtime/full", // MOUNT_EXTERNAL_FULL
};
// Must match values in com.android.internal.os.Zygote.
@@ -633,6 +646,23 @@ static int UnmountTree(const char* path) {
return 0;
}
+static void CreateDir(const std::string& dir, mode_t mode, uid_t uid, gid_t gid,
+ fail_fn_t fail_fn) {
+ if (fs_prepare_dir(dir.c_str(), mode, uid, gid) != 0) {
+ fail_fn(CREATE_ERROR("fs_prepare_dir failed on %s: %s",
+ dir.c_str(), strerror(errno)));
+ }
+}
+
+static void BindMount(const std::string& source_dir, const std::string& target_dir,
+ fail_fn_t fail_fn) {
+ if (TEMP_FAILURE_RETRY(mount(source_dir.c_str(), target_dir.c_str(), nullptr,
+ MS_BIND | MS_REC, nullptr)) == -1) {
+ fail_fn(CREATE_ERROR("Failed to mount %s to %s: %s",
+ source_dir.c_str(), target_dir.c_str(), strerror(errno)));
+ }
+}
+
// Create a private mount namespace and bind mount appropriate emulated
// storage for the given user.
static void MountEmulatedStorage(uid_t uid, jint mount_mode,
@@ -641,18 +671,11 @@ static void MountEmulatedStorage(uid_t uid, jint mount_mode,
// See storage config details at http://source.android.com/tech/storage/
ATRACE_CALL();
- String8 storage_source;
- if (mount_mode == MOUNT_EXTERNAL_DEFAULT) {
- storage_source = "/mnt/runtime/default";
- } else if (mount_mode == MOUNT_EXTERNAL_READ) {
- storage_source = "/mnt/runtime/read";
- } else if (mount_mode == MOUNT_EXTERNAL_WRITE
- || mount_mode == MOUNT_EXTERNAL_LEGACY
- || mount_mode == MOUNT_EXTERNAL_INSTALLER) {
- storage_source = "/mnt/runtime/write";
- } else if (mount_mode == MOUNT_EXTERNAL_FULL) {
- storage_source = "/mnt/runtime/full";
- } else if (mount_mode == MOUNT_EXTERNAL_NONE && !force_mount_namespace) {
+ if (mount_mode < 0 || mount_mode >= MOUNT_EXTERNAL_COUNT) {
+ fail_fn(CREATE_ERROR("Unknown mount_mode: %d", mount_mode));
+ }
+
+ if (mount_mode == MOUNT_EXTERNAL_NONE && !force_mount_namespace) {
// Sane default of no storage visible
return;
}
@@ -667,26 +690,15 @@ static void MountEmulatedStorage(uid_t uid, jint mount_mode,
return;
}
- if (TEMP_FAILURE_RETRY(mount(storage_source.string(), "/storage", nullptr,
- MS_BIND | MS_REC | MS_SLAVE, nullptr)) == -1) {
- fail_fn(CREATE_ERROR("Failed to mount %s to /storage: %s",
- storage_source.string(),
- strerror(errno)));
- }
+ const std::string& storage_source = ExternalStorageViews[mount_mode];
+
+ BindMount(storage_source, "/storage", fail_fn);
// Mount user-specific symlink helper into place
userid_t user_id = multiuser_get_user_id(uid);
- const String8 user_source(String8::format("/mnt/user/%d", user_id));
- if (fs_prepare_dir(user_source.string(), 0751, 0, 0) == -1) {
- fail_fn(CREATE_ERROR("fs_prepare_dir failed on %s",
- user_source.string()));
- }
-
- if (TEMP_FAILURE_RETRY(mount(user_source.string(), "/storage/self",
- nullptr, MS_BIND, nullptr)) == -1) {
- fail_fn(CREATE_ERROR("Failed to mount %s to /storage/self: %s",
- user_source.string(), strerror(errno)));
- }
+ const std::string user_source = StringPrintf("/mnt/user/%d", user_id);
+ CreateDir(user_source, 0751, AID_ROOT, AID_ROOT, fail_fn);
+ BindMount(user_source, "/storage/self", fail_fn);
}
static bool NeedsNoRandomizeWorkaround() {
diff --git a/core/proto/android/app/settings_enums.proto b/core/proto/android/app/settings_enums.proto
index 4874c4199eaa..4b6a6dec4c45 100644
--- a/core/proto/android/app/settings_enums.proto
+++ b/core/proto/android/app/settings_enums.proto
@@ -2380,6 +2380,11 @@ enum PageId {
// Note: Only shows up on first time toggle
DIALOG_DARK_UI_INFO = 1740;
+ // OPEN: Settings > About phone > Legal information > Google Play system update licenses
+ // CATEGORY: SETTINGS
+ // OS: Q
+ MODULE_LICENSES_DASHBOARD = 1746;
+
// OPEN: Settings > System > Gestures > Global Actions Panel
// CATEGORY: SETTINGS
// OS: Q
diff --git a/core/proto/android/server/connectivity/Android.bp b/core/proto/android/server/connectivity/Android.bp
index c0ac2cb8f800..413623963851 100644
--- a/core/proto/android/server/connectivity/Android.bp
+++ b/core/proto/android/server/connectivity/Android.bp
@@ -21,5 +21,4 @@ java_library_static {
"data_stall_event.proto",
],
sdk_version: "system_current",
- no_framework_libs: true,
-} \ No newline at end of file
+}
diff --git a/core/proto/android/server/windowmanagerservice.proto b/core/proto/android/server/windowmanagerservice.proto
index e6ae22658f31..777902578e1b 100644
--- a/core/proto/android/server/windowmanagerservice.proto
+++ b/core/proto/android/server/windowmanagerservice.proto
@@ -45,6 +45,7 @@ message WindowManagerServiceDumpProto {
optional bool display_frozen = 6;
optional int32 rotation = 7;
optional int32 last_orientation = 8;
+ optional int32 focused_display_id = 9;
}
/* represents RootWindowContainer object */
diff --git a/core/proto/android/stats/connectivity/Android.bp b/core/proto/android/stats/connectivity/Android.bp
index 5aa4ddbdf7f9..5d642d3845fe 100644
--- a/core/proto/android/stats/connectivity/Android.bp
+++ b/core/proto/android/stats/connectivity/Android.bp
@@ -21,5 +21,4 @@ java_library_static {
"network_stack.proto",
],
sdk_version: "system_current",
- no_framework_libs: true,
-} \ No newline at end of file
+}
diff --git a/core/proto/android/stats/devicepolicy/Android.bp b/core/proto/android/stats/devicepolicy/Android.bp
index 6ae54e23117d..5fb278a34dae 100644
--- a/core/proto/android/stats/devicepolicy/Android.bp
+++ b/core/proto/android/stats/devicepolicy/Android.bp
@@ -29,5 +29,5 @@ java_library_static {
static_libs: ["libprotobuf-java-nano"],
}
},
- no_framework_libs: true,
+ sdk_version: "core_platform",
}
diff --git a/core/proto/android/stats/dnsresolver/Android.bp b/core/proto/android/stats/dnsresolver/Android.bp
index 0b5aa8677a6e..1e8c76314448 100644
--- a/core/proto/android/stats/dnsresolver/Android.bp
+++ b/core/proto/android/stats/dnsresolver/Android.bp
@@ -21,5 +21,4 @@ java_library_static {
"dns_resolver.proto",
],
sdk_version: "system_current",
- no_framework_libs: true,
}
diff --git a/core/res/Android.bp b/core/res/Android.bp
index 4e60f8ca025c..3402033b04f1 100644
--- a/core/res/Android.bp
+++ b/core/res/Android.bp
@@ -16,7 +16,7 @@
android_app {
name: "framework-res",
- no_framework_libs: true,
+ sdk_version: "core_platform",
certificate: "platform",
// Soong special-cases framework-res to install this alongside
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 55d80ac065c3..1a79adc70baf 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -364,7 +364,7 @@
overridden by the device to present the capability of creating socket keepalives. -->
<!-- An Array of "[NetworkCapabilities.TRANSPORT_*],[supported keepalives] -->
<string-array translatable="false" name="config_networkSupportedKeepaliveCount">
- <item>0,3</item>
+ <item>0,1</item>
<item>1,3</item>
</string-array>
diff --git a/core/tests/coretests/src/android/service/notification/StatusBarNotificationTest.java b/core/tests/coretests/src/android/service/notification/StatusBarNotificationTest.java
index 0f32a827377e..6161108d4d70 100644
--- a/core/tests/coretests/src/android/service/notification/StatusBarNotificationTest.java
+++ b/core/tests/coretests/src/android/service/notification/StatusBarNotificationTest.java
@@ -24,6 +24,7 @@ import static org.mockito.Mockito.when;
import android.app.ActivityManager;
import android.app.Notification;
+import android.app.Person;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
@@ -87,6 +88,9 @@ public class StatusBarNotificationTest {
assertEquals(0,
logMaker.getTaggedData(MetricsEvent.FIELD_NOTIFICATION_GROUP_SUMMARY));
assertNull(logMaker.getTaggedData(MetricsEvent.FIELD_NOTIFICATION_CATEGORY));
+ assertNull(logMaker.getTaggedData(MetricsEvent.FIELD_NOTIFICATION_STYLE));
+ assertNull(logMaker.getTaggedData(MetricsEvent.FIELD_NOTIFICATION_PEOPLE));
+
}
/** Verify that modifying the returned logMaker won't leave stale data behind for
@@ -159,6 +163,24 @@ public class StatusBarNotificationTest {
sbn.getLogMaker().getTaggedData(MetricsEvent.FIELD_NOTIFICATION_GROUP_ID));
}
+ @Test
+ public void testLogMakerWithPerson() {
+ Notification.Builder builder = getNotificationBuilder(GROUP_ID_1, CHANNEL_ID)
+ .addPerson(new Person.Builder().build());
+ final LogMaker logMaker = getNotification(PKG, builder).getLogMaker();
+ assertEquals(1,
+ logMaker.getTaggedData(MetricsEvent.FIELD_NOTIFICATION_PEOPLE));
+ }
+
+ @Test
+ public void testLogMakerWithStyle() {
+ Notification.Builder builder = getNotificationBuilder(GROUP_ID_1, CHANNEL_ID)
+ .setStyle(new Notification.MessagingStyle(new Person.Builder().build()));
+ final LogMaker logMaker = getNotification(PKG, builder).getLogMaker();
+ assertEquals("android.app.Notification$MessagingStyle".hashCode(),
+ logMaker.getTaggedData(MetricsEvent.FIELD_NOTIFICATION_STYLE));
+ }
+
private StatusBarNotification getNotification(String pkg, String group, String channelId) {
return getNotification(pkg, getNotificationBuilder(group, channelId));
}
diff --git a/core/tests/coretests/src/android/util/TimingsTraceLogTest.java b/core/tests/coretests/src/android/util/TimingsTraceLogTest.java
index 77d05524d7cf..f76471c015e6 100644
--- a/core/tests/coretests/src/android/util/TimingsTraceLogTest.java
+++ b/core/tests/coretests/src/android/util/TimingsTraceLogTest.java
@@ -16,7 +16,7 @@
package android.util;
-import static org.junit.Assert.assertTrue;
+import static com.google.common.truth.Truth.assertThat;
import android.os.Trace;
@@ -31,7 +31,8 @@ import java.util.List;
/**
* Tests for {@link TimingsTraceLog}.
- * <p>Usage: bit FrameworksCoreTests:android.util.TimingsTraceLogTest
+ *
+ * <p>Usage: {@code atest FrameworksCoreTests:android.util.TimingsTraceLogTest}
*/
@SmallTest
@RunWith(AndroidJUnit4.class)
@@ -64,7 +65,24 @@ public class TimingsTraceLogTest {
});
t.start();
t.join();
- assertTrue(errors.toString(), errors.isEmpty());
+ assertThat(errors).isEmpty();
}
+ @Test
+ public void testGetUnfinishedTracesForDebug() {
+ TimingsTraceLog log = new TimingsTraceLog("TEST", Trace.TRACE_TAG_APP);
+ assertThat(log.getUnfinishedTracesForDebug()).isEmpty();
+
+ log.traceBegin("One");
+ assertThat(log.getUnfinishedTracesForDebug()).containsExactly("One").inOrder();
+
+ log.traceBegin("Two");
+ assertThat(log.getUnfinishedTracesForDebug()).containsExactly("One", "Two").inOrder();
+
+ log.traceEnd();
+ assertThat(log.getUnfinishedTracesForDebug()).containsExactly("One").inOrder();
+
+ log.traceEnd();
+ assertThat(log.getUnfinishedTracesForDebug()).isEmpty();
+ }
}
diff --git a/data/etc/car/com.android.car.developeroptions.xml b/data/etc/car/com.android.car.developeroptions.xml
index 76c8c622ba71..5f5e908322bc 100644
--- a/data/etc/car/com.android.car.developeroptions.xml
+++ b/data/etc/car/com.android.car.developeroptions.xml
@@ -42,6 +42,7 @@
<permission name="android.permission.PACKAGE_USAGE_STATS"/>
<permission name="android.permission.READ_SEARCH_INDEXABLES"/>
<permission name="android.permission.REBOOT"/>
+ <permission name="android.permission.REQUEST_NETWORK_SCORES"/>
<permission name="android.permission.SET_TIME"/>
<permission name="android.permission.STATUS_BAR"/>
<permission name="android.permission.TETHER_PRIVILEGED"/>
diff --git a/data/etc/com.android.systemui.xml b/data/etc/com.android.systemui.xml
index a305d48c4633..1d735af524a4 100644
--- a/data/etc/com.android.systemui.xml
+++ b/data/etc/com.android.systemui.xml
@@ -44,6 +44,7 @@
<permission name="android.permission.READ_NETWORK_USAGE_HISTORY"/>
<permission name="android.permission.READ_PRIVILEGED_PHONE_STATE"/>
<permission name="android.permission.REAL_GET_TASKS"/>
+ <permission name="android.permission.REQUEST_NETWORK_SCORES"/>
<permission name="android.permission.RECEIVE_MEDIA_RESOURCE_USAGE"/>
<permission name="android.permission.START_ACTIVITIES_FROM_BACKGROUND" />
<permission name="android.permission.START_ACTIVITY_AS_CALLER"/>
diff --git a/data/etc/privapp-permissions-platform.xml b/data/etc/privapp-permissions-platform.xml
index a640122f2b32..ff4e1005c9d9 100644
--- a/data/etc/privapp-permissions-platform.xml
+++ b/data/etc/privapp-permissions-platform.xml
@@ -185,6 +185,7 @@ applications that come with the platform
<permission name="android.permission.ACCESS_CACHE_FILESYSTEM"/>
<permission name="android.permission.CLEAR_APP_CACHE"/>
<permission name="android.permission.CONNECTIVITY_INTERNAL"/>
+ <permission name="android.permission.START_ACTIVITIES_FROM_BACKGROUND"/>
<permission name="android.permission.UPDATE_APP_OPS_STATS"/>
<permission name="android.permission.UPDATE_DEVICE_STATS"/>
</privapp-permissions>
diff --git a/graphics/proto/Android.bp b/graphics/proto/Android.bp
index 1d06348fb02f..ddced597759f 100644
--- a/graphics/proto/Android.bp
+++ b/graphics/proto/Android.bp
@@ -5,7 +5,6 @@ java_library_static {
type: "lite",
},
srcs: ["game_driver.proto"],
- no_framework_libs: true,
jarjar_rules: "jarjar-rules.txt",
sdk_version: "28",
}
diff --git a/media/Android.bp b/media/Android.bp
index 70dacb20cde7..4f9671f9936b 100644
--- a/media/Android.bp
+++ b/media/Android.bp
@@ -27,7 +27,7 @@ java_library {
installable: true,
// Make sure that the implementaion only relies on SDK or system APIs.
- no_framework_libs: true,
+ sdk_version: "core_platform",
libs: [
// The order matters. android_system_* library should come later.
"framework_media_annotation",
diff --git a/media/java/android/media/ExifInterface.java b/media/java/android/media/ExifInterface.java
index 5645ba5d7dac..7ae6a0277bff 100644
--- a/media/java/android/media/ExifInterface.java
+++ b/media/java/android/media/ExifInterface.java
@@ -367,6 +367,8 @@ public class ExifInterface {
public static final String TAG_THUMBNAIL_IMAGE_LENGTH = "ThumbnailImageLength";
/** Type is int. */
public static final String TAG_THUMBNAIL_IMAGE_WIDTH = "ThumbnailImageWidth";
+ /** Type is int. */
+ public static final String TAG_THUMBNAIL_ORIENTATION = "ThumbnailOrientation";
/** Type is int. DNG Specification 1.4.0.0. Section 4 */
public static final String TAG_DNG_VERSION = "DNGVersion";
/** Type is int. DNG Specification 1.4.0.0. Section 4 */
@@ -1155,7 +1157,7 @@ public class ExifInterface {
new ExifTag(TAG_MAKE, 271, IFD_FORMAT_STRING),
new ExifTag(TAG_MODEL, 272, IFD_FORMAT_STRING),
new ExifTag(TAG_STRIP_OFFSETS, 273, IFD_FORMAT_USHORT, IFD_FORMAT_ULONG),
- new ExifTag(TAG_ORIENTATION, 274, IFD_FORMAT_USHORT),
+ new ExifTag(TAG_THUMBNAIL_ORIENTATION, 274, IFD_FORMAT_USHORT),
new ExifTag(TAG_SAMPLES_PER_PIXEL, 277, IFD_FORMAT_USHORT),
new ExifTag(TAG_ROWS_PER_STRIP, 278, IFD_FORMAT_USHORT, IFD_FORMAT_ULONG),
new ExifTag(TAG_STRIP_BYTE_COUNTS, 279, IFD_FORMAT_USHORT, IFD_FORMAT_ULONG),
diff --git a/media/proto/Android.bp b/media/proto/Android.bp
index 74fd5255ecd5..2dc0d579c0da 100644
--- a/media/proto/Android.bp
+++ b/media/proto/Android.bp
@@ -5,7 +5,6 @@ java_library_static {
type: "lite",
},
srcs: ["mediaplayer2.proto"],
- no_framework_libs: true,
jarjar_rules: "jarjar-rules.txt",
sdk_version: "28",
}
diff --git a/packages/CarSystemUI/res/values/config.xml b/packages/CarSystemUI/res/values/config.xml
index d946fbc9520a..467c4a41893d 100644
--- a/packages/CarSystemUI/res/values/config.xml
+++ b/packages/CarSystemUI/res/values/config.xml
@@ -29,6 +29,9 @@
<bool name="config_enableRightNavigationBar">false</bool>
<bool name="config_enableBottomNavigationBar">true</bool>
+ <!-- Whether heads-up notifications should be shown when shade is open. -->
+ <bool name="config_enableHeadsUpNotificationWhenNotificationShadeOpen">true</bool>
+
<bool name="config_hideNavWhenKeyguardBouncerShown">true</bool>
<bool name="config_enablePersistentDockedActivity">false</bool>
<string name="config_persistentDockedActivityIntentUri" translatable="false"></string>
diff --git a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java
index 16b01252fb81..ed5ab6a91e41 100644
--- a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java
+++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java
@@ -165,6 +165,8 @@ public class CarStatusBar extends StatusBar implements
private boolean mIsNotificationCardSwiping;
// If notification shade is being swiped vertically to close.
private boolean mIsSwipingVerticallyToClose;
+ // Whether heads-up notifications should be shown when shade is open.
+ private boolean mEnableHeadsUpNotificationWhenNotificationShadeOpen;
private final CarPowerStateListener mCarPowerStateListener =
(int state) -> {
@@ -423,14 +425,13 @@ public class CarStatusBar extends StatusBar implements
}
);
- mNotificationClickHandlerFactory = new NotificationClickHandlerFactory(
- mBarService,
- launchResult -> {
- if (launchResult == ActivityManager.START_TASK_TO_FRONT
- || launchResult == ActivityManager.START_SUCCESS) {
- animateCollapsePanels();
- }
- });
+ mNotificationClickHandlerFactory = new NotificationClickHandlerFactory(mBarService);
+ mNotificationClickHandlerFactory.registerClickListener((launchResult, alertEntry) -> {
+ if (launchResult == ActivityManager.START_TASK_TO_FRONT
+ || launchResult == ActivityManager.START_SUCCESS) {
+ animateCollapsePanels();
+ }
+ });
Car car = Car.createCar(mContext);
CarUxRestrictionsManager carUxRestrictionsManager = (CarUxRestrictionsManager)
car.getCarManager(Car.CAR_UX_RESTRICTION_SERVICE);
@@ -459,6 +460,8 @@ public class CarStatusBar extends StatusBar implements
}
});
+ mEnableHeadsUpNotificationWhenNotificationShadeOpen = mContext.getResources().getBoolean(
+ R.bool.config_enableHeadsUpNotificationWhenNotificationShadeOpen);
CarHeadsUpNotificationManager carHeadsUpNotificationManager =
new CarSystemUIHeadsUpNotificationManager(mContext,
mNotificationClickHandlerFactory, mNotificationDataManager);
@@ -1273,11 +1276,18 @@ public class CarStatusBar extends StatusBar implements
}
@Override
+ protected void setInternalInsetsInfo(ViewTreeObserver.InternalInsetsInfo info,
+ HeadsUpEntry currentNotification, boolean panelExpanded) {
+ super.setInternalInsetsInfo(info, currentNotification, mPanelExpanded);
+ }
+
+ @Override
protected void setHeadsUpVisible() {
// if the Notifications panel is showing don't show the Heads up
- if (mPanelExpanded) {
+ if (!mEnableHeadsUpNotificationWhenNotificationShadeOpen && mPanelExpanded) {
return;
}
+
super.setHeadsUpVisible();
if (mHeadsUpPanel.getVisibility() == View.VISIBLE) {
mStatusBarWindowController.setHeadsUpShowing(true);
diff --git a/packages/PackageInstaller/res/values/strings.xml b/packages/PackageInstaller/res/values/strings.xml
index 797656ef62f4..3e4270621554 100644
--- a/packages/PackageInstaller/res/values/strings.xml
+++ b/packages/PackageInstaller/res/values/strings.xml
@@ -4,9 +4,9 @@
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.
@@ -185,9 +185,6 @@
<!-- Placeholder for an app name when it is unknown [CHAR LIMIT=50] -->
<string name="app_name_unknown">Unknown</string>
- <!-- Help URL, application permissions [DO NOT TRANSLATE] -->
- <string name="help_app_permissions" translatable="false"></string>
-
<!-- Text to show in warning dialog on the tablet when the app source is not trusted [CHAR LIMIT=NONE] -->
<string name="untrusted_external_source_warning" product="tablet">For your security, your tablet is not allowed to install unknown apps from this source.</string>
diff --git a/packages/SettingsLib/Tile/src/com/android/settingslib/drawer/Tile.java b/packages/SettingsLib/Tile/src/com/android/settingslib/drawer/Tile.java
index 05c2f24001e8..ca2d1ed122f9 100644
--- a/packages/SettingsLib/Tile/src/com/android/settingslib/drawer/Tile.java
+++ b/packages/SettingsLib/Tile/src/com/android/settingslib/drawer/Tile.java
@@ -24,6 +24,7 @@ import static com.android.settingslib.drawer.TileUtils.META_DATA_PREFERENCE_KEYH
import static com.android.settingslib.drawer.TileUtils.META_DATA_PREFERENCE_SUMMARY;
import static com.android.settingslib.drawer.TileUtils.META_DATA_PREFERENCE_SUMMARY_URI;
import static com.android.settingslib.drawer.TileUtils.META_DATA_PREFERENCE_TITLE;
+import static com.android.settingslib.drawer.TileUtils.META_DATA_PREFERENCE_TITLE_URI;
import static com.android.settingslib.drawer.TileUtils.PROFILE_ALL;
import static com.android.settingslib.drawer.TileUtils.PROFILE_PRIMARY;
@@ -168,6 +169,11 @@ public class Tile implements Parcelable {
ensureMetadataNotStale(context);
final PackageManager packageManager = context.getPackageManager();
if (mMetaData.containsKey(META_DATA_PREFERENCE_TITLE)) {
+ if (mMetaData.containsKey(META_DATA_PREFERENCE_TITLE_URI)) {
+ // If has as uri to provide dynamic summary, skip loading here. UI will later load
+ // at tile binding time.
+ return null;
+ }
if (mMetaData.get(META_DATA_PREFERENCE_TITLE) instanceof Integer) {
try {
final Resources res =
@@ -211,6 +217,8 @@ public class Tile implements Parcelable {
final PackageManager packageManager = context.getPackageManager();
if (mMetaData != null) {
if (mMetaData.containsKey(META_DATA_PREFERENCE_SUMMARY_URI)) {
+ // If has as uri to provide dynamic summary, skip loading here. UI will later load
+ // at tile binding time.
return null;
}
if (mMetaData.containsKey(META_DATA_PREFERENCE_SUMMARY)) {
diff --git a/packages/SettingsLib/Tile/src/com/android/settingslib/drawer/TileUtils.java b/packages/SettingsLib/Tile/src/com/android/settingslib/drawer/TileUtils.java
index 31925ab64ec3..aced5ef9429a 100644
--- a/packages/SettingsLib/Tile/src/com/android/settingslib/drawer/TileUtils.java
+++ b/packages/SettingsLib/Tile/src/com/android/settingslib/drawer/TileUtils.java
@@ -162,6 +162,16 @@ public class TileUtils {
/**
* Name of the meta-data item that should be set in the AndroidManifest.xml
+ * to specify the content provider providing the title text that should be displayed for the
+ * preference.
+ *
+ * Title provided by the content provider overrides any static title.
+ */
+ public static final String META_DATA_PREFERENCE_TITLE_URI =
+ "com.android.settings.title_uri";
+
+ /**
+ * Name of the meta-data item that should be set in the AndroidManifest.xml
* to specify the summary text that should be displayed for the preference.
*/
public static final String META_DATA_PREFERENCE_SUMMARY = "com.android.settings.summary";
diff --git a/packages/SystemUI/plugin/src/com/android/systemui/plugins/SensorManagerPlugin.java b/packages/SystemUI/plugin/src/com/android/systemui/plugins/SensorManagerPlugin.java
index 2cbd788d0a30..60435d0dec35 100644
--- a/packages/SystemUI/plugin/src/com/android/systemui/plugins/SensorManagerPlugin.java
+++ b/packages/SystemUI/plugin/src/com/android/systemui/plugins/SensorManagerPlugin.java
@@ -58,7 +58,7 @@ public interface SensorManagerPlugin extends Plugin {
public static final int TYPE_WAKE_LOCK_SCREEN = 1;
public static final int TYPE_WAKE_DISPLAY = 2;
public static final int TYPE_SWIPE = 3;
- public static final int TYPE_STATUS = 4;
+ public static final int TYPE_SKIP_STATUS = 4;
private int mType;
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 e19fe0779124..c36f81de91d3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -494,7 +494,7 @@ public class StatusBar extends SystemUI implements DemoMode,
private Runnable mLaunchTransitionEndRunnable;
private NotificationEntry mDraggedDownEntry;
- private boolean mLaunchCameraOnScreenTurningOn;
+ private boolean mLaunchCameraWhenFinishedWaking;
private boolean mLaunchCameraOnFinishedGoingToSleep;
private int mLastCameraLaunchSource;
protected PowerManager.WakeLock mGestureWakeLock;
@@ -3597,7 +3597,7 @@ public class StatusBar extends SystemUI implements DemoMode,
public void onFinishedGoingToSleep() {
mNotificationPanel.onAffordanceLaunchEnded();
releaseGestureWakeLock();
- mLaunchCameraOnScreenTurningOn = false;
+ mLaunchCameraWhenFinishedWaking = false;
mDeviceInteractive = false;
mWakeUpComingFromTouch = false;
mWakeUpTouchLocation = null;
@@ -3644,6 +3644,11 @@ public class StatusBar extends SystemUI implements DemoMode,
@Override
public void onFinishedWakingUp() {
mWakeUpCoordinator.setWakingUp(false);
+ if (mLaunchCameraWhenFinishedWaking) {
+ mNotificationPanel.launchCamera(false /* animate */, mLastCameraLaunchSource);
+ mLaunchCameraWhenFinishedWaking = false;
+ }
+ updateScrimController();
}
};
@@ -3665,13 +3670,6 @@ public class StatusBar extends SystemUI implements DemoMode,
public void onScreenTurningOn() {
mFalsingManager.onScreenTurningOn();
mNotificationPanel.onScreenTurningOn();
-
- if (mLaunchCameraOnScreenTurningOn) {
- mNotificationPanel.launchCamera(false, mLastCameraLaunchSource);
- mLaunchCameraOnScreenTurningOn = false;
- }
-
- updateScrimController();
}
@Override
@@ -3772,7 +3770,7 @@ public class StatusBar extends SystemUI implements DemoMode,
// comes on.
mGestureWakeLock.acquire(LAUNCH_TRANSITION_TIMEOUT_MS + 1000L);
}
- if (isScreenTurningOnOrOn()) {
+ if (isWakingUpOrAwake()) {
if (DEBUG_CAMERA_LIFT) Slog.d(TAG, "Launching camera");
if (mStatusBarKeyguardViewManager.isBouncerShowing()) {
mStatusBarKeyguardViewManager.reset(true /* hide */);
@@ -3785,7 +3783,7 @@ public class StatusBar extends SystemUI implements DemoMode,
// incorrectly get notified because of the screen on event (which resumes and pauses
// some activities)
if (DEBUG_CAMERA_LIFT) Slog.d(TAG, "Deferring until screen turns on");
- mLaunchCameraOnScreenTurningOn = true;
+ mLaunchCameraWhenFinishedWaking = true;
}
}
}
@@ -3810,9 +3808,9 @@ public class StatusBar extends SystemUI implements DemoMode,
== WakefulnessLifecycle.WAKEFULNESS_GOING_TO_SLEEP;
}
- private boolean isScreenTurningOnOrOn() {
- return mScreenLifecycle.getScreenState() == ScreenLifecycle.SCREEN_TURNING_ON
- || mScreenLifecycle.getScreenState() == ScreenLifecycle.SCREEN_ON;
+ private boolean isWakingUpOrAwake() {
+ return mWakefulnessLifecycle.getWakefulness() == WAKEFULNESS_AWAKE
+ || mWakefulnessLifecycle.getWakefulness() == WAKEFULNESS_WAKING;
}
public void notifyBiometricAuthModeChanged() {
@@ -3844,7 +3842,7 @@ public class StatusBar extends SystemUI implements DemoMode,
ScrimState state = mStatusBarKeyguardViewManager.bouncerNeedsScrimming()
? ScrimState.BOUNCER_SCRIMMED : ScrimState.BOUNCER;
mScrimController.transitionTo(state);
- } else if (isInLaunchTransition() || mLaunchCameraOnScreenTurningOn
+ } else if (isInLaunchTransition() || mLaunchCameraWhenFinishedWaking
|| launchingAffordanceWithPreview) {
mScrimController.transitionTo(ScrimState.UNLOCKED, mUnlockScrimCallback);
} else if (mBrightnessMirrorVisible) {
diff --git a/proto/Android.bp b/proto/Android.bp
index 7b119a771ba4..65bccbb4aac8 100644
--- a/proto/Android.bp
+++ b/proto/Android.bp
@@ -5,7 +5,6 @@ java_library_static {
type: "nano",
},
srcs: ["src/**/*.proto"],
- no_framework_libs: true,
sdk_version: "9",
// Pin java_version until jarjar is certified to support later versions. http://b/72703434
java_version: "1.8",
@@ -26,6 +25,5 @@ java_library_static {
type: "nano",
},
srcs: ["src/metrics_constants/metrics_constants.proto"],
- no_framework_libs: true,
sdk_version: "system_current",
}
diff --git a/proto/src/metrics_constants/metrics_constants.proto b/proto/src/metrics_constants/metrics_constants.proto
index 0f0e6f9fb446..c58e92971e4f 100644
--- a/proto/src/metrics_constants/metrics_constants.proto
+++ b/proto/src/metrics_constants/metrics_constants.proto
@@ -7388,6 +7388,20 @@ message MetricsEvent {
// CATEGORY: NOTIFICATION
MEDIA_NOTIFICATION_SEEKBAR = 1743;
+ // Custom tag for StatusBarNotification. Length of
+ // Notification.extras[EXTRA_PEOPLE_LIST], set by addPerson().
+ FIELD_NOTIFICATION_PEOPLE = 1744;
+
+ // Custom tag for StatusBarNotification. The Java hashcode of
+ // Notification.extras[EXTRA_TEMPLATE], which is a string like
+ // android.app.Notification$MessagingStyle, set by setStyle().
+ FIELD_NOTIFICATION_STYLE = 1745;
+
+ // OPEN: Settings > About phone > Legal information > Google Play system update licenses
+ // CATEGORY: SETTINGS
+ // OS: Q
+ MODULE_LICENSES_DASHBOARD = 1746;
+
// ---- End Q Constants, all Q constants go above this line ----
// Add new aosp constants above this line.
// END OF AOSP CONSTANTS
diff --git a/services/core/java/com/android/server/SystemServiceManager.java b/services/core/java/com/android/server/SystemServiceManager.java
index c5b4966ddcf2..9711152ec5b1 100644
--- a/services/core/java/com/android/server/SystemServiceManager.java
+++ b/services/core/java/com/android/server/SystemServiceManager.java
@@ -17,12 +17,15 @@
package com.android.server;
import android.annotation.NonNull;
+import android.annotation.UserIdInt;
import android.content.Context;
import android.os.Environment;
import android.os.SystemClock;
import android.os.Trace;
import android.util.Slog;
+import com.android.server.utils.TimingsTraceAndSlog;
+
import java.io.File;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
@@ -138,9 +141,10 @@ public class SystemServiceManager {
* Starts the specified boot phase for all system services that have been started up to
* this point.
*
+ * @param t trace logger
* @param phase The boot phase to start.
*/
- public void startBootPhase(final int phase) {
+ public void startBootPhase(@NonNull TimingsTraceAndSlog t, int phase) {
if (phase <= mCurrentPhase) {
throw new IllegalArgumentException("Next phase must be larger than previous");
}
@@ -148,12 +152,12 @@ public class SystemServiceManager {
Slog.i(TAG, "Starting phase " + mCurrentPhase);
try {
- Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "OnBootPhase " + phase);
+ t.traceBegin("OnBootPhase " + phase);
final int serviceLen = mServices.size();
for (int i = 0; i < serviceLen; i++) {
final SystemService service = mServices.get(i);
long time = SystemClock.elapsedRealtime();
- Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, service.getClass().getName());
+ t.traceBegin(service.getClass().getName());
try {
service.onBootPhase(mCurrentPhase);
} catch (Exception ex) {
@@ -163,10 +167,15 @@ public class SystemServiceManager {
+ mCurrentPhase, ex);
}
warnIfTooLong(SystemClock.elapsedRealtime() - time, service, "onBootPhase");
- Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
+ t.traceEnd();
}
} finally {
- Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
+ t.traceEnd();
+ }
+
+ if (phase == SystemService.PHASE_BOOT_COMPLETED) {
+ final long totalBootTime = SystemClock.uptimeMillis() - mRuntimeStartUptime;
+ t.logDuration("TotalBootTime", totalBootTime);
}
}
@@ -177,13 +186,17 @@ public class SystemServiceManager {
return mCurrentPhase >= SystemService.PHASE_BOOT_COMPLETED;
}
- public void startUser(final int userHandle) {
+ /**
+ * Starts the given user.
+ */
+ public void startUser(@NonNull TimingsTraceAndSlog t, final @UserIdInt int userHandle) {
+ t.traceBegin("ssm.startUser-" + userHandle);
Slog.i(TAG, "Calling onStartUser u" + userHandle);
final int serviceLen = mServices.size();
for (int i = 0; i < serviceLen; i++) {
final SystemService service = mServices.get(i);
- Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "onStartUser "
- + service.getClass().getName());
+ final String serviceName = service.getClass().getName();
+ t.traceBegin("onStartUser-" + userHandle + " " + serviceName);
long time = SystemClock.elapsedRealtime();
try {
service.onStartUser(userHandle);
@@ -192,84 +205,109 @@ public class SystemServiceManager {
+ " to service " + service.getClass().getName(), ex);
}
warnIfTooLong(SystemClock.elapsedRealtime() - time, service, "onStartUser ");
- Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
+ t.traceEnd();
}
+ t.traceEnd();
}
- public void unlockUser(final int userHandle) {
+ /**
+ * Unlocks the given user.
+ */
+ public void unlockUser(final @UserIdInt int userHandle) {
+ final TimingsTraceAndSlog t = TimingsTraceAndSlog.newAsyncLog();
+ t.traceBegin("ssm.unlockUser-" + userHandle);
Slog.i(TAG, "Calling onUnlockUser u" + userHandle);
final int serviceLen = mServices.size();
for (int i = 0; i < serviceLen; i++) {
final SystemService service = mServices.get(i);
- Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "onUnlockUser "
- + service.getClass().getName());
+ final String serviceName = service.getClass().getName();
+ t.traceBegin("onUnlockUser-" + userHandle + " " + serviceName);
long time = SystemClock.elapsedRealtime();
try {
service.onUnlockUser(userHandle);
} catch (Exception ex) {
Slog.wtf(TAG, "Failure reporting unlock of user " + userHandle
- + " to service " + service.getClass().getName(), ex);
+ + " to service " + serviceName, ex);
}
warnIfTooLong(SystemClock.elapsedRealtime() - time, service, "onUnlockUser ");
- Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
+ t.traceEnd();
}
+ t.traceEnd();
}
- public void switchUser(final int userHandle) {
+ /**
+ * Switches to the given user.
+ */
+ public void switchUser(final @UserIdInt int userHandle) {
+ final TimingsTraceAndSlog t = TimingsTraceAndSlog.newAsyncLog();
+ t.traceBegin("ssm.switchUser-" + userHandle);
Slog.i(TAG, "Calling switchUser u" + userHandle);
final int serviceLen = mServices.size();
for (int i = 0; i < serviceLen; i++) {
final SystemService service = mServices.get(i);
- Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "onSwitchUser "
- + service.getClass().getName());
+ final String serviceName = service.getClass().getName();
+ t.traceBegin("onSwitchUser-" + userHandle + " " + serviceName);
long time = SystemClock.elapsedRealtime();
try {
service.onSwitchUser(userHandle);
} catch (Exception ex) {
Slog.wtf(TAG, "Failure reporting switch of user " + userHandle
- + " to service " + service.getClass().getName(), ex);
+ + " to service " + serviceName, ex);
}
warnIfTooLong(SystemClock.elapsedRealtime() - time, service, "onSwitchUser");
- Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
+ t.traceEnd();
}
+ t.traceEnd();
}
- public void stopUser(final int userHandle) {
+ /**
+ * Stops the given user.
+ */
+ public void stopUser(final @UserIdInt int userHandle) {
+ final TimingsTraceAndSlog t = TimingsTraceAndSlog.newAsyncLog();
+ t.traceBegin("ssm.stopUser-" + userHandle);
Slog.i(TAG, "Calling onStopUser u" + userHandle);
final int serviceLen = mServices.size();
for (int i = 0; i < serviceLen; i++) {
final SystemService service = mServices.get(i);
- Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "onStopUser "
- + service.getClass().getName());
+ final String serviceName = service.getClass().getName();
+ t.traceBegin("onStopUser-" + userHandle + " " + serviceName);
long time = SystemClock.elapsedRealtime();
try {
service.onStopUser(userHandle);
} catch (Exception ex) {
Slog.wtf(TAG, "Failure reporting stop of user " + userHandle
- + " to service " + service.getClass().getName(), ex);
+ + " to service " + serviceName, ex);
}
warnIfTooLong(SystemClock.elapsedRealtime() - time, service, "onStopUser");
- Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
+ t.traceEnd();
}
+ t.traceEnd();
}
- public void cleanupUser(final int userHandle) {
+ /**
+ * Cleans up the given user.
+ */
+ public void cleanupUser(final @UserIdInt int userHandle) {
+ final TimingsTraceAndSlog t = TimingsTraceAndSlog.newAsyncLog();
+ t.traceBegin("ssm.cleanupUser-" + userHandle);
Slog.i(TAG, "Calling onCleanupUser u" + userHandle);
final int serviceLen = mServices.size();
for (int i = 0; i < serviceLen; i++) {
final SystemService service = mServices.get(i);
- Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "onCleanupUser "
- + service.getClass().getName());
+ final String serviceName = service.getClass().getName();
+ t.traceBegin("onCleanupUser-" + userHandle + " " + serviceName);
long time = SystemClock.elapsedRealtime();
try {
service.onCleanupUser(userHandle);
} catch (Exception ex) {
Slog.wtf(TAG, "Failure reporting cleanup of user " + userHandle
- + " to service " + service.getClass().getName(), ex);
+ + " to service " + serviceName, ex);
}
warnIfTooLong(SystemClock.elapsedRealtime() - time, service, "onCleanupUser");
- Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
+ t.traceEnd();
}
+ t.traceEnd();
}
/** Sets the safe mode flag for services to query. */
diff --git a/services/core/java/com/android/server/UiModeManagerService.java b/services/core/java/com/android/server/UiModeManagerService.java
index 0eb3a8438ae3..59589cd26859 100644
--- a/services/core/java/com/android/server/UiModeManagerService.java
+++ b/services/core/java/com/android/server/UiModeManagerService.java
@@ -46,7 +46,9 @@ import android.os.ResultReceiver;
import android.os.ServiceManager;
import android.os.ShellCallback;
import android.os.ShellCommand;
+import android.os.SystemProperties;
import android.os.UserHandle;
+import android.os.UserManager;
import android.provider.Settings.Secure;
import android.service.dreams.Sandman;
import android.service.vr.IVrManager;
@@ -64,6 +66,7 @@ import com.android.server.twilight.TwilightState;
import java.io.FileDescriptor;
import java.io.PrintWriter;
+import java.util.Objects;
final class UiModeManagerService extends SystemService {
private static final String TAG = UiModeManager.class.getSimpleName();
@@ -71,6 +74,7 @@ final class UiModeManagerService extends SystemService {
// Enable launching of applications when entering the dock.
private static final boolean ENABLE_LAUNCH_DESK_DOCK_APP = true;
+ private static final String SYSTEM_PROPERTY_DEVICE_THEME = "persist.sys.theme";
final Object mLock = new Object();
private int mDockState = Intent.EXTRA_DOCK_STATE_UNDOCKED;
@@ -330,8 +334,13 @@ final class UiModeManagerService extends SystemService {
mNightMode = defaultNightMode;
}
- // false if night mode stayed the same, true otherwise.
- return !(oldNightMode == mNightMode);
+ if (UserManager.get(context).isPrimaryUser()) {
+ final String newTheme = Integer.toString(mNightMode);
+ if (!Objects.equals(SystemProperties.get(SYSTEM_PROPERTY_DEVICE_THEME), mNightMode)) {
+ SystemProperties.set(SYSTEM_PROPERTY_DEVICE_THEME, newTheme);
+ }
+ }
+ return oldNightMode != mNightMode;
}
private final IUiModeManager.Stub mService = new IUiModeManager.Stub() {
@@ -411,6 +420,11 @@ final class UiModeManagerService extends SystemService {
try {
synchronized (mLock) {
if (mNightMode != mode) {
+ if (UserManager.get(getContext()).isPrimaryUser()) {
+ SystemProperties.set(SYSTEM_PROPERTY_DEVICE_THEME,
+ Integer.toString(mode));
+ }
+
// Only persist setting if not in car mode
if (!mCarModeEnabled) {
Secure.putIntForUser(getContext().getContentResolver(),
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index aa2a08634ac9..1c53b9e5f48e 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -5094,7 +5094,8 @@ public class ActivityManagerService extends IActivityManager.Stub
}
final void finishBooting() {
- TimingsTraceAndSlog t = new TimingsTraceAndSlog(TAG, Trace.TRACE_TAG_ACTIVITY_MANAGER);
+ TimingsTraceAndSlog t = new TimingsTraceAndSlog(TAG + "Timing",
+ Trace.TRACE_TAG_ACTIVITY_MANAGER);
t.traceBegin("FinishBooting");
synchronized (this) {
@@ -5168,7 +5169,7 @@ public class ActivityManagerService extends IActivityManager.Stub
}
// Let system services know.
- mSystemServiceManager.startBootPhase(SystemService.PHASE_BOOT_COMPLETED);
+ mSystemServiceManager.startBootPhase(t, SystemService.PHASE_BOOT_COMPLETED);
synchronized (this) {
// Ensure that any processes we had put on hold are now started
@@ -8866,9 +8867,11 @@ public class ActivityManagerService extends IActivityManager.Stub
if (goingCallback != null) {
goingCallback.run();
}
+ t.traceEnd(); // PhaseActivityManagerReady
return;
}
+ t.traceBegin("controllersReady");
mLocalDeviceIdleController
= LocalServices.getService(DeviceIdleController.LocalService.class);
mActivityTaskManager.onSystemReady();
@@ -8876,6 +8879,7 @@ public class ActivityManagerService extends IActivityManager.Stub
mUserController.onSystemReady();
mAppOpsService.systemReady();
mSystemReady = true;
+ t.traceEnd();
}
try {
@@ -8884,6 +8888,7 @@ public class ActivityManagerService extends IActivityManager.Stub
.getSerial();
} catch (RemoteException e) {}
+ t.traceBegin("killProcesses");
ArrayList<ProcessRecord> procsToKill = null;
synchronized(mPidsSelfLocked) {
for (int i=mPidsSelfLocked.size()-1; i>=0; i--) {
@@ -8911,17 +8916,28 @@ public class ActivityManagerService extends IActivityManager.Stub
// we won't trample on them any more.
mProcessesReady = true;
}
+ t.traceEnd(); // KillProcesses
Slog.i(TAG, "System now ready");
EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_AMS_READY, SystemClock.uptimeMillis());
+ t.traceBegin("updateTopComponentForFactoryTest");
mAtmInternal.updateTopComponentForFactoryTest();
+ t.traceEnd();
+ t.traceBegin("watchDeviceProvisioning");
watchDeviceProvisioning(mContext);
+ t.traceEnd();
+ t.traceBegin("retrieveSettings");
retrieveSettings();
+ t.traceEnd();
+
+ t.traceBegin("Ugm.onSystemReady");
mUgmInternal.onSystemReady();
+ t.traceEnd();
+ t.traceBegin("updateForceBackgroundCheck");
final PowerManagerInternal pmi = LocalServices.getService(PowerManagerInternal.class);
if (pmi != null) {
pmi.registerLowPowerModeObserver(ServiceType.FORCE_BACKGROUND_CHECK,
@@ -8931,8 +8947,11 @@ public class ActivityManagerService extends IActivityManager.Stub
} else {
Slog.wtf(TAG, "PowerManagerInternal not found.");
}
+ t.traceEnd();
if (goingCallback != null) goingCallback.run();
+
+ t.traceBegin("getCurrentUser"); // should be fast, but these methods acquire locks
// Check the current user here as a user can be started inside goingCallback.run() from
// other system services.
final int currentUserId = mUserController.getCurrentUserId();
@@ -8943,17 +8962,21 @@ public class ActivityManagerService extends IActivityManager.Stub
throw new RuntimeException("System user not started while current user is:"
+ currentUserId);
}
+ t.traceEnd();
+
t.traceBegin("ActivityManagerStartApps");
mBatteryStatsService.noteEvent(BatteryStats.HistoryItem.EVENT_USER_RUNNING_START,
Integer.toString(currentUserId), currentUserId);
mBatteryStatsService.noteEvent(BatteryStats.HistoryItem.EVENT_USER_FOREGROUND_START,
Integer.toString(currentUserId), currentUserId);
- mSystemServiceManager.startUser(currentUserId);
+ mSystemServiceManager.startUser(t, currentUserId);
synchronized (this) {
// Only start up encryption-aware persistent apps; once user is
// unlocked we'll come back around and start unaware apps
+ t.traceBegin("startPersistentApps");
startPersistentApps(PackageManager.MATCH_DIRECT_BOOT_AWARE);
+ t.traceEnd();
// Start up initial activity.
mBooting = true;
@@ -8963,6 +8986,7 @@ public class ActivityManagerService extends IActivityManager.Stub
if (UserManager.isSplitSystemUser() &&
Settings.Secure.getInt(mContext.getContentResolver(),
Settings.Secure.USER_SETUP_COMPLETE, 0) != 0) {
+ t.traceBegin("enableHomeActivity");
ComponentName cName = new ComponentName(mContext, SystemUserHomeActivity.class);
try {
AppGlobals.getPackageManager().setComponentEnabledSetting(cName,
@@ -8971,63 +8995,81 @@ public class ActivityManagerService extends IActivityManager.Stub
} catch (RemoteException e) {
throw e.rethrowAsRuntimeException();
}
+ t.traceEnd();
}
+ t.traceBegin("startHomeOnAllDisplays");
mAtmInternal.startHomeOnAllDisplays(currentUserId, "systemReady");
+ t.traceEnd();
+ t.traceBegin("showSystemReadyErrorDialogs");
mAtmInternal.showSystemReadyErrorDialogsIfNeeded();
+ t.traceEnd();
- final int callingUid = Binder.getCallingUid();
- final int callingPid = Binder.getCallingPid();
- long ident = Binder.clearCallingIdentity();
- try {
- Intent intent = new Intent(Intent.ACTION_USER_STARTED);
- intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY
- | Intent.FLAG_RECEIVER_FOREGROUND);
- intent.putExtra(Intent.EXTRA_USER_HANDLE, currentUserId);
- broadcastIntentLocked(null, null, intent,
- null, null, 0, null, null, null, OP_NONE,
- null, false, false, MY_PID, SYSTEM_UID, callingUid, callingPid,
- currentUserId);
- intent = new Intent(Intent.ACTION_USER_STARTING);
- intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
- intent.putExtra(Intent.EXTRA_USER_HANDLE, currentUserId);
- broadcastIntentLocked(null, null, intent,
- null, new IIntentReceiver.Stub() {
- @Override
- public void performReceive(Intent intent, int resultCode, String data,
- Bundle extras, boolean ordered, boolean sticky, int sendingUser)
- throws RemoteException {
- }
- }, 0, null, null,
- new String[] {INTERACT_ACROSS_USERS}, OP_NONE,
- null, true, false, MY_PID, SYSTEM_UID, callingUid, callingPid,
- UserHandle.USER_ALL);
- } catch (Throwable e) {
- Slog.wtf(TAG, "Failed sending first user broadcasts", e);
- } finally {
- Binder.restoreCallingIdentity(ident);
+ boolean isSystemUser = currentUserId == UserHandle.USER_SYSTEM;
+ if (isSystemUser) {
+ t.traceBegin("sendUserStartBroadcast");
+ final int callingUid = Binder.getCallingUid();
+ final int callingPid = Binder.getCallingPid();
+ long ident = Binder.clearCallingIdentity();
+ try {
+ Intent intent = new Intent(Intent.ACTION_USER_STARTED);
+ intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY
+ | Intent.FLAG_RECEIVER_FOREGROUND);
+ intent.putExtra(Intent.EXTRA_USER_HANDLE, currentUserId);
+ broadcastIntentLocked(null, null, intent,
+ null, null, 0, null, null, null, OP_NONE,
+ null, false, false, MY_PID, SYSTEM_UID, callingUid, callingPid,
+ currentUserId);
+ intent = new Intent(Intent.ACTION_USER_STARTING);
+ intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
+ intent.putExtra(Intent.EXTRA_USER_HANDLE, currentUserId);
+ broadcastIntentLocked(null, null, intent, null,
+ new IIntentReceiver.Stub() {
+ @Override
+ public void performReceive(Intent intent, int resultCode,
+ String data, Bundle extras, boolean ordered, boolean sticky,
+ int sendingUser) {}
+ }, 0, null, null, new String[] {INTERACT_ACROSS_USERS}, OP_NONE, null,
+ true, false, MY_PID, SYSTEM_UID, callingUid, callingPid,
+ UserHandle.USER_ALL);
+ } catch (Throwable e) {
+ Slog.wtf(TAG, "Failed sending first user broadcasts", e);
+ } finally {
+ Binder.restoreCallingIdentity(ident);
+ }
+ t.traceEnd();
+ } else {
+ Slog.i(TAG, "Not sending multi-user broadcasts for non-system user "
+ + currentUserId);
}
+
+ t.traceBegin("resumeTopActivities");
mAtmInternal.resumeTopActivities(false /* scheduleIdle */);
- mUserController.sendUserSwitchBroadcasts(-1, currentUserId);
+ t.traceEnd();
+
+ if (isSystemUser) {
+ t.traceBegin("sendUserSwitchBroadcasts");
+ mUserController.sendUserSwitchBroadcasts(-1, currentUserId);
+ t.traceEnd();
+ }
+ t.traceBegin("setBinderProxies");
BinderInternal.nSetBinderProxyCountWatermarks(BINDER_PROXY_HIGH_WATERMARK,
BINDER_PROXY_LOW_WATERMARK);
BinderInternal.nSetBinderProxyCountEnabled(true);
BinderInternal.setBinderProxyCountCallback(
- new BinderInternal.BinderProxyLimitListener() {
- @Override
- public void onLimitReached(int uid) {
- Slog.wtf(TAG, "Uid " + uid + " sent too many Binders to uid "
- + Process.myUid());
- BinderProxy.dumpProxyDebugInfo();
- if (uid == Process.SYSTEM_UID) {
- Slog.i(TAG, "Skipping kill (uid is SYSTEM)");
- } else {
- killUid(UserHandle.getAppId(uid), UserHandle.getUserId(uid),
- "Too many Binders sent to SYSTEM");
- }
+ (uid) -> {
+ Slog.wtf(TAG, "Uid " + uid + " sent too many Binders to uid "
+ + Process.myUid());
+ BinderProxy.dumpProxyDebugInfo();
+ if (uid == Process.SYSTEM_UID) {
+ Slog.i(TAG, "Skipping kill (uid is SYSTEM)");
+ } else {
+ killUid(UserHandle.getAppId(uid), UserHandle.getUserId(uid),
+ "Too many Binders sent to SYSTEM");
}
}, mHandler);
+ t.traceEnd(); // setBinderProxies
t.traceEnd(); // ActivityManagerStartApps
t.traceEnd(); // PhaseActivityManagerReady
diff --git a/services/core/java/com/android/server/am/UserController.java b/services/core/java/com/android/server/am/UserController.java
index a7d347ba3a88..d4ceb5a86946 100644
--- a/services/core/java/com/android/server/am/UserController.java
+++ b/services/core/java/com/android/server/am/UserController.java
@@ -72,7 +72,6 @@ import android.os.RemoteCallbackList;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemClock;
-import android.os.Trace;
import android.os.UserHandle;
import android.os.UserManager;
import android.os.UserManagerInternal;
@@ -85,7 +84,6 @@ import android.util.Pair;
import android.util.Slog;
import android.util.SparseArray;
import android.util.SparseIntArray;
-import android.util.TimingsTraceLog;
import android.util.proto.ProtoOutputStream;
import com.android.internal.R;
@@ -978,11 +976,13 @@ class UserController implements Handler.Callback {
* <ul>
* <li>{@link Intent#ACTION_USER_STARTED} - sent to registered receivers of the new user
* <li>{@link Intent#ACTION_USER_BACKGROUND} - sent to registered receivers of the outgoing
- * user and all profiles of this user. Sent only if {@code foreground} parameter is true
+ * user and all profiles of this user. Sent only if {@code foreground} parameter is
+ * {@code false}
* <li>{@link Intent#ACTION_USER_FOREGROUND} - sent to registered receivers of the new
- * user and all profiles of this user. Sent only if {@code foreground} parameter is true
+ * user and all profiles of this user. Sent only if {@code foreground} parameter is
+ * {@code true}
* <li>{@link Intent#ACTION_USER_SWITCHED} - sent to registered receivers of the new user.
- * Sent only if {@code foreground} parameter is true
+ * Sent only if {@code foreground} parameter is {@code true}
* <li>{@link Intent#ACTION_USER_STARTING} - ordered broadcast sent to registered receivers
* of the new fg user
* <li>{@link Intent#ACTION_LOCKED_BOOT_COMPLETED} - ordered broadcast sent to receivers of
@@ -2135,6 +2135,7 @@ class UserController implements Handler.Callback {
}
}
+ @Override
public boolean handleMessage(Message msg) {
switch (msg.what) {
case START_USER_SWITCH_FG_MSG:
@@ -2159,7 +2160,8 @@ class UserController implements Handler.Callback {
mInjector.batteryStatsServiceNoteEvent(
BatteryStats.HistoryItem.EVENT_USER_RUNNING_START,
Integer.toString(msg.arg1), msg.arg1);
- mInjector.getSystemServiceManager().startUser(msg.arg1);
+ mInjector.getSystemServiceManager().startUser(TimingsTraceAndSlog.newAsyncLog(),
+ msg.arg1);
break;
case SYSTEM_USER_UNLOCK_MSG:
final int userId = msg.arg1;
@@ -2215,14 +2217,12 @@ class UserController implements Handler.Callback {
// Report system user unlock time to perf dashboard
if (id == UserHandle.USER_SYSTEM) {
- new TimingsTraceLog("SystemServerTiming", Trace.TRACE_TAG_SYSTEM_SERVER)
- .logDuration("SystemUserUnlock", unlockTime);
+ new TimingsTraceAndSlog().logDuration("SystemUserUnlock", unlockTime);
} else {
- new TimingsTraceLog("SystemServerTiming", Trace.TRACE_TAG_SYSTEM_SERVER)
- .logDuration("User" + id + "Unlock", unlockTime);
+ new TimingsTraceAndSlog().logDuration("User" + id + "Unlock", unlockTime);
}
}
- };
+ }
@VisibleForTesting
static class Injector {
diff --git a/services/core/java/com/android/server/connectivity/KeepaliveTracker.java b/services/core/java/com/android/server/connectivity/KeepaliveTracker.java
index 626d724404c7..9bae902eb7b1 100644
--- a/services/core/java/com/android/server/connectivity/KeepaliveTracker.java
+++ b/services/core/java/com/android/server/connectivity/KeepaliveTracker.java
@@ -562,7 +562,7 @@ public class KeepaliveTracker {
if (KeepaliveInfo.STARTING == ki.mStartedState) {
if (SUCCESS == reason) {
// Keepalive successfully started.
- if (DBG) Log.d(TAG, "Started keepalive " + slot + " on " + nai.name());
+ Log.d(TAG, "Started keepalive " + slot + " on " + nai.name());
ki.mStartedState = KeepaliveInfo.STARTED;
try {
ki.mCallback.onStarted(slot);
diff --git a/services/core/java/com/android/server/locksettings/LockSettingsService.java b/services/core/java/com/android/server/locksettings/LockSettingsService.java
index 750a4deffc63..433ce811c8d7 100644
--- a/services/core/java/com/android/server/locksettings/LockSettingsService.java
+++ b/services/core/java/com/android/server/locksettings/LockSettingsService.java
@@ -1290,6 +1290,7 @@ public class LockSettingsService extends ILockSettings.Stub {
final BiometricManager bm = mContext.getSystemService(BiometricManager.class);
final PackageManager pm = mContext.getPackageManager();
for (int i = 0; i < resetLockouts.size(); i++) {
+ bm.setActiveUser(resetLockouts.get(i).mUserId);
bm.resetLockout(resetLockouts.get(i).mHAT);
}
if (challengeType == CHALLENGE_INTERNAL
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index c3188c87d49e..83c9c7341854 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -2399,6 +2399,13 @@ public class NotificationManagerService extends SystemService {
}
@Override
+ public void silenceNotificationSound() {
+ checkCallerIsSystem();
+
+ mNotificationDelegate.clearEffects();
+ }
+
+ @Override
public void setNotificationsEnabledForPackage(String pkg, int uid, boolean enabled) {
enforceSystemOrSystemUI("setNotificationsEnabledForPackage");
diff --git a/services/core/java/com/android/server/pm/Installer.java b/services/core/java/com/android/server/pm/Installer.java
index adcd19e9bb5a..b3b0029326d5 100644
--- a/services/core/java/com/android/server/pm/Installer.java
+++ b/services/core/java/com/android/server/pm/Installer.java
@@ -85,6 +85,9 @@ public class Installer extends SystemService {
public static final int FLAG_USE_QUOTA = IInstalld.FLAG_USE_QUOTA;
public static final int FLAG_FORCE = IInstalld.FLAG_FORCE;
+ public static final int FLAG_CLEAR_APP_DATA_KEEP_ART_PROFILES =
+ IInstalld.FLAG_CLEAR_APP_DATA_KEEP_ART_PROFILES;
+
private final boolean mIsolated;
private volatile IInstalld mInstalld;
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 311739a45cdc..ef115f07faf5 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -322,6 +322,7 @@ import com.android.server.pm.permission.PermissionManagerServiceInternal.Permiss
import com.android.server.pm.permission.PermissionsState;
import com.android.server.security.VerityUtils;
import com.android.server.storage.DeviceStorageMonitorInternal;
+import com.android.server.utils.TimingsTraceAndSlog;
import com.android.server.wm.ActivityTaskManagerInternal;
import dalvik.system.CloseGuard;
@@ -2384,10 +2385,12 @@ public class PackageManagerService extends IPackageManager.Stub
}
}
- public PackageManagerService(Context context, Installer installer,
- boolean factoryTest, boolean onlyCore) {
+ public PackageManagerService(Context context, Installer installer, boolean factoryTest,
+ boolean onlyCore) {
+ final TimingsTraceAndSlog t = new TimingsTraceAndSlog(TAG + "Timing",
+ Trace.TRACE_TAG_PACKAGE_MANAGER);
+ t.traceBegin("create package manager");
LockGuard.installLock(mPackages, LockGuard.INDEX_PACKAGES);
- Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "create package manager");
EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_PMS_START,
SystemClock.uptimeMillis());
@@ -2403,6 +2406,8 @@ public class PackageManagerService extends IPackageManager.Stub
mInstaller = installer;
// Create sub-components that provide services / data. Order here is important.
+ t.traceBegin("createSubComponents");
+ // CHECKSTYLE:OFF IndentationCheck
synchronized (mInstallLock) {
synchronized (mPackages) {
// Expose private service for system components to use.
@@ -2420,6 +2425,10 @@ public class PackageManagerService extends IPackageManager.Stub
mPermissionManager.getPermissionSettings(), mPackages);
}
}
+ // CHECKSTYLE:ON IndentationCheck
+ t.traceEnd();
+
+ t.traceBegin("addSharedUsers");
mSettings.addSharedUserLPw("android.uid.system", Process.SYSTEM_UID,
ApplicationInfo.FLAG_SYSTEM, ApplicationInfo.PRIVATE_FLAG_PRIVILEGED);
mSettings.addSharedUserLPw("android.uid.phone", RADIO_UID,
@@ -2436,6 +2445,7 @@ public class PackageManagerService extends IPackageManager.Stub
ApplicationInfo.FLAG_SYSTEM, ApplicationInfo.PRIVATE_FLAG_PRIVILEGED);
mSettings.addSharedUserLPw("android.uid.networkstack", NETWORKSTACK_UID,
ApplicationInfo.FLAG_SYSTEM, ApplicationInfo.PRIVATE_FLAG_PRIVILEGED);
+ t.traceEnd();
String separateProcesses = SystemProperties.get("debug.separate_processes");
if (separateProcesses != null && separateProcesses.length() > 0) {
@@ -2467,14 +2477,15 @@ public class PackageManagerService extends IPackageManager.Stub
getDefaultDisplayMetrics(context, mMetrics);
- Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "get system config");
+ t.traceBegin("get system config");
SystemConfig systemConfig = SystemConfig.getInstance();
mAvailableFeatures = systemConfig.getAvailableFeatures();
- Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER);
+ t.traceEnd();
mProtectedPackages = new ProtectedPackages(mContext);
mApexManager = new ApexManager(context);
+ // CHECKSTYLE:OFF IndentationCheck
synchronized (mInstallLock) {
// writer
synchronized (mPackages) {
@@ -2513,13 +2524,13 @@ public class PackageManagerService extends IPackageManager.Stub
SELinuxMMAC.readInstallPolicy();
- Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "loadFallbacks");
+ t.traceBegin("loadFallbacks");
FallbackCategoryProvider.loadFallbacks();
- Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER);
+ t.traceEnd();
- Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "read user settings");
+ t.traceBegin("read user settings");
mFirstBoot = !mSettings.readLPw(sUserManager.getUsers(false));
- Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER);
+ t.traceEnd();
// Clean up orphaned packages for which the code path doesn't exist
// and they are an update to a system app - caused by bug/32321269
@@ -3240,7 +3251,8 @@ public class PackageManagerService extends IPackageManager.Stub
// No apps are running this early, so no need to freeze
clearAppDataLIF(ps.pkg, UserHandle.USER_ALL,
FLAG_STORAGE_DE | FLAG_STORAGE_CE | FLAG_STORAGE_EXTERNAL
- | Installer.FLAG_CLEAR_CODE_CACHE_ONLY);
+ | Installer.FLAG_CLEAR_CODE_CACHE_ONLY
+ | Installer.FLAG_CLEAR_APP_DATA_KEEP_ART_PROFILES);
}
}
ver.fingerprint = Build.FINGERPRINT;
@@ -3269,9 +3281,9 @@ public class PackageManagerService extends IPackageManager.Stub
ver.databaseVersion = Settings.CURRENT_DATABASE_VERSION;
// can downgrade to reader
- Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "write settings");
+ t.traceBegin("write settings");
mSettings.writeLPr();
- Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER);
+ t.traceEnd();
EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_PMS_READY,
SystemClock.uptimeMillis());
@@ -3357,15 +3369,16 @@ public class PackageManagerService extends IPackageManager.Stub
}
} // synchronized (mPackages)
} // synchronized (mInstallLock)
+ // CHECKSTYLE:ON IndentationCheck
mModuleInfoProvider = new ModuleInfoProvider(mContext, this);
// Now after opening every single application zip, make sure they
// are all flushed. Not really needed, but keeps things nice and
// tidy.
- Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "GC");
+ t.traceBegin("GC");
Runtime.getRuntime().gc();
- Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER);
+ t.traceEnd();
// The initial scanning above does many calls into installd while
// holding the mPackages lock, but we're mostly interested in yelling
@@ -3376,7 +3389,7 @@ public class PackageManagerService extends IPackageManager.Stub
mServiceStartWithDelay = SystemClock.uptimeMillis() + (60 * 1000L);
- Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER);
+ t.traceEnd(); // "create package manager"
}
/**
@@ -10320,7 +10333,9 @@ public class PackageManagerService extends IPackageManager.Stub
clearAppDataLeafLIF(pkg.childPackages.get(i), userId, flags);
}
- clearAppProfilesLIF(pkg, UserHandle.USER_ALL);
+ if ((flags & Installer.FLAG_CLEAR_APP_DATA_KEEP_ART_PROFILES) == 0) {
+ clearAppProfilesLIF(pkg, UserHandle.USER_ALL);
+ }
}
private void clearAppDataLeafLIF(PackageParser.Package pkg, int userId, int flags) {
@@ -22541,7 +22556,8 @@ public class PackageManagerService extends IPackageManager.Stub
if (!Build.FINGERPRINT.equals(ver.fingerprint)) {
clearAppDataLIF(ps.pkg, UserHandle.USER_ALL, FLAG_STORAGE_DE | FLAG_STORAGE_CE
- | FLAG_STORAGE_EXTERNAL | Installer.FLAG_CLEAR_CODE_CACHE_ONLY);
+ | FLAG_STORAGE_EXTERNAL | Installer.FLAG_CLEAR_CODE_CACHE_ONLY
+ | Installer.FLAG_CLEAR_APP_DATA_KEEP_ART_PROFILES);
}
}
}
diff --git a/services/core/java/com/android/server/pm/UserManagerService.java b/services/core/java/com/android/server/pm/UserManagerService.java
index 829dd0f3cb06..f4ba4492dcbb 100644
--- a/services/core/java/com/android/server/pm/UserManagerService.java
+++ b/services/core/java/com/android/server/pm/UserManagerService.java
@@ -3693,6 +3693,11 @@ public class UserManagerService extends IUserManager.Stub {
long now = System.currentTimeMillis();
final long nowRealtime = SystemClock.elapsedRealtime();
+
+ final int currentUser = LocalServices.getService(ActivityManagerInternal.class)
+ .getCurrentUserId();
+ pw.print("Current user: "); pw.println(currentUser);
+
StringBuilder sb = new StringBuilder();
synchronized (mPackagesLock) {
synchronized (mUsersLock) {
@@ -3706,6 +3711,7 @@ public class UserManagerService extends IUserManager.Stub {
final int userId = userInfo.id;
pw.print(" "); pw.print(userInfo);
pw.print(" serialNo="); pw.print(userInfo.serialNumber);
+ pw.print(" isPrimary="); pw.print(userInfo.isPrimary());
if (mRemovingUserIds.get(userId)) {
pw.print(" <removing> ");
}
@@ -3788,13 +3794,15 @@ public class UserManagerService extends IUserManager.Stub {
synchronized (mUserStates) {
pw.println(" Started users state: " + mUserStates);
}
- // Dump some capabilities
- pw.println();
- pw.println(" Max users: " + UserManager.getMaxSupportedUsers());
- pw.println(" Supports switchable users: " + UserManager.supportsMultipleUsers());
- pw.println(" All guests ephemeral: " + Resources.getSystem().getBoolean(
- com.android.internal.R.bool.config_guestUserEphemeral));
- }
+ } // synchronized (mPackagesLock)
+
+ // Dump some capabilities
+ pw.println();
+ pw.println(" Max users: " + UserManager.getMaxSupportedUsers());
+ pw.println(" Supports switchable users: " + UserManager.supportsMultipleUsers());
+ pw.println(" All guests ephemeral: " + Resources.getSystem().getBoolean(
+ com.android.internal.R.bool.config_guestUserEphemeral));
+ pw.println(" Is split-system user: " + UserManager.isSplitSystemUser());
}
private static void dumpTimeAgo(PrintWriter pw, StringBuilder sb, long nowTime, long time) {
diff --git a/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java b/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
index 03c77893a24b..db01d7754d06 100644
--- a/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
+++ b/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
@@ -143,12 +143,6 @@ public final class DefaultPermissionGrantPolicy {
CONTACTS_PERMISSIONS.add(Manifest.permission.GET_ACCOUNTS);
}
- private static final Set<String> LOCATION_PERMISSIONS = new ArraySet<>();
- static {
- LOCATION_PERMISSIONS.add(Manifest.permission.ACCESS_FINE_LOCATION);
- LOCATION_PERMISSIONS.add(Manifest.permission.ACCESS_COARSE_LOCATION);
- }
-
private static final Set<String> ALWAYS_LOCATION_PERMISSIONS = new ArraySet<>();
static {
ALWAYS_LOCATION_PERMISSIONS.add(Manifest.permission.ACCESS_FINE_LOCATION);
@@ -453,7 +447,8 @@ public final class DefaultPermissionGrantPolicy {
// SetupWizard
grantPermissionsToSystemPackage(
getKnownPackage(PackageManagerInternal.PACKAGE_SETUP_WIZARD, userId), userId,
- PHONE_PERMISSIONS, CONTACTS_PERMISSIONS, LOCATION_PERMISSIONS, CAMERA_PERMISSIONS);
+ PHONE_PERMISSIONS, CONTACTS_PERMISSIONS, ALWAYS_LOCATION_PERMISSIONS,
+ CAMERA_PERMISSIONS);
// Camera
grantPermissionsToSystemPackage(
@@ -585,7 +580,7 @@ public final class DefaultPermissionGrantPolicy {
// Maps
grantPermissionsToSystemPackage(
getDefaultSystemHandlerActivityPackageForCategory(Intent.CATEGORY_APP_MAPS, userId),
- userId, LOCATION_PERMISSIONS);
+ userId, ALWAYS_LOCATION_PERMISSIONS);
// Gallery
grantPermissionsToSystemPackage(
@@ -609,14 +604,14 @@ public final class DefaultPermissionGrantPolicy {
}
}
grantPermissionsToPackage(browserPackage, userId, false /* ignoreSystemPackage */,
- true /*whitelistRestrictedPermissions*/, LOCATION_PERMISSIONS);
+ true /*whitelistRestrictedPermissions*/, ALWAYS_LOCATION_PERMISSIONS);
// Voice interaction
if (voiceInteractPackageNames != null) {
for (String voiceInteractPackageName : voiceInteractPackageNames) {
grantPermissionsToSystemPackage(voiceInteractPackageName, userId,
CONTACTS_PERMISSIONS, CALENDAR_PERMISSIONS, MICROPHONE_PERMISSIONS,
- PHONE_PERMISSIONS, SMS_PERMISSIONS, LOCATION_PERMISSIONS);
+ PHONE_PERMISSIONS, SMS_PERMISSIONS, ALWAYS_LOCATION_PERMISSIONS);
}
}
@@ -625,7 +620,7 @@ public final class DefaultPermissionGrantPolicy {
grantPermissionsToSystemPackage(
getDefaultSystemHandlerActivityPackage(
SearchManager.INTENT_ACTION_GLOBAL_SEARCH, userId),
- userId, MICROPHONE_PERMISSIONS, LOCATION_PERMISSIONS);
+ userId, MICROPHONE_PERMISSIONS, ALWAYS_LOCATION_PERMISSIONS);
}
// Voice recognition
@@ -667,7 +662,7 @@ public final class DefaultPermissionGrantPolicy {
.addCategory(Intent.CATEGORY_LAUNCHER_APP);
grantPermissionsToSystemPackage(
getDefaultSystemHandlerActivityPackage(homeIntent, userId), userId,
- LOCATION_PERMISSIONS);
+ ALWAYS_LOCATION_PERMISSIONS);
// Watches
if (mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_WATCH, 0)) {
@@ -676,18 +671,18 @@ public final class DefaultPermissionGrantPolicy {
String wearPackage = getDefaultSystemHandlerActivityPackageForCategory(
Intent.CATEGORY_HOME_MAIN, userId);
grantPermissionsToSystemPackage(wearPackage, userId,
- CONTACTS_PERMISSIONS, MICROPHONE_PERMISSIONS, LOCATION_PERMISSIONS);
+ CONTACTS_PERMISSIONS, MICROPHONE_PERMISSIONS, ALWAYS_LOCATION_PERMISSIONS);
grantSystemFixedPermissionsToSystemPackage(wearPackage, userId, PHONE_PERMISSIONS);
// Fitness tracking on watches
grantPermissionsToSystemPackage(
getDefaultSystemHandlerActivityPackage(ACTION_TRACK, userId), userId,
- SENSORS_PERMISSIONS, LOCATION_PERMISSIONS);
+ SENSORS_PERMISSIONS, ALWAYS_LOCATION_PERMISSIONS);
}
// Print Spooler
grantSystemFixedPermissionsToSystemPackage(PrintManager.PRINT_SPOOLER_PACKAGE_NAME, userId,
- LOCATION_PERMISSIONS);
+ ALWAYS_LOCATION_PERMISSIONS);
// EmergencyInfo
grantSystemFixedPermissionsToSystemPackage(
@@ -725,7 +720,7 @@ public final class DefaultPermissionGrantPolicy {
if (!TextUtils.isEmpty(textClassifierPackageName)) {
grantPermissionsToSystemPackage(textClassifierPackageName, userId,
PHONE_PERMISSIONS, SMS_PERMISSIONS, CALENDAR_PERMISSIONS,
- LOCATION_PERMISSIONS, CONTACTS_PERMISSIONS);
+ ALWAYS_LOCATION_PERMISSIONS, CONTACTS_PERMISSIONS);
}
// Atthention Service
@@ -835,7 +830,7 @@ public final class DefaultPermissionGrantPolicy {
}
for (String packageName : packageNames) {
grantPermissionsToSystemPackage(packageName, userId,
- PHONE_PERMISSIONS, MICROPHONE_PERMISSIONS, LOCATION_PERMISSIONS,
+ PHONE_PERMISSIONS, MICROPHONE_PERMISSIONS, ALWAYS_LOCATION_PERMISSIONS,
CAMERA_PERMISSIONS, CONTACTS_PERMISSIONS);
}
}
@@ -850,7 +845,7 @@ public final class DefaultPermissionGrantPolicy {
// Grant these permissions as system-fixed, so that nobody can accidentally
// break cellular data.
grantSystemFixedPermissionsToSystemPackage(packageName, userId,
- PHONE_PERMISSIONS, LOCATION_PERMISSIONS);
+ PHONE_PERMISSIONS, ALWAYS_LOCATION_PERMISSIONS);
}
}
@@ -864,7 +859,7 @@ public final class DefaultPermissionGrantPolicy {
PackageInfo pkg = getSystemPackageInfo(packageName);
if (isSystemPackage(pkg) && doesPackageSupportRuntimePermissions(pkg)) {
revokeRuntimePermissions(packageName, PHONE_PERMISSIONS, true, userId);
- revokeRuntimePermissions(packageName, LOCATION_PERMISSIONS, true, userId);
+ revokeRuntimePermissions(packageName, ALWAYS_LOCATION_PERMISSIONS, true, userId);
}
}
}
@@ -889,7 +884,7 @@ public final class DefaultPermissionGrantPolicy {
public void grantDefaultPermissionsToDefaultBrowser(String packageName, int userId) {
Log.i(TAG, "Granting permissions to default browser for user:" + userId);
- grantPermissionsToSystemPackage(packageName, userId, LOCATION_PERMISSIONS);
+ grantPermissionsToSystemPackage(packageName, userId, ALWAYS_LOCATION_PERMISSIONS);
}
private String getDefaultSystemHandlerActivityPackage(String intentAction, int userId) {
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 5456d38502d5..74ab2a96a52c 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -107,6 +107,7 @@ import android.app.ActivityManagerInternal;
import android.app.ActivityTaskManager;
import android.app.AppOpsManager;
import android.app.IUiModeManager;
+import android.app.NotificationManager;
import android.app.ProgressDialog;
import android.app.SearchManager;
import android.app.UiModeManager;
@@ -2565,6 +2566,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
return (TelecomManager) mContext.getSystemService(Context.TELECOM_SERVICE);
}
+ NotificationManager getNotificationService() {
+ return mContext.getSystemService(NotificationManager.class);
+ }
+
static IAudioService getAudioService() {
IAudioService audioService = IAudioService.Stub.asInterface(
ServiceManager.checkService(Context.AUDIO_SERVICE));
@@ -3799,6 +3804,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
if (down) {
sendSystemKeyToStatusBarAsync(event.getKeyCode());
+ NotificationManager nm = getNotificationService();
+ if (nm != null && !mHandleVolumeKeysInWM) {
+ nm.silenceNotificationSound();
+ }
+
TelecomManager telecomManager = getTelecommService();
if (telecomManager != null && !mHandleVolumeKeysInWM) {
// When {@link #mHandleVolumeKeysInWM} is set, volume key events
diff --git a/services/core/java/com/android/server/stats/StatsCompanionService.java b/services/core/java/com/android/server/stats/StatsCompanionService.java
index 63439d538224..11348532ec00 100644
--- a/services/core/java/com/android/server/stats/StatsCompanionService.java
+++ b/services/core/java/com/android/server/stats/StatsCompanionService.java
@@ -1254,6 +1254,12 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
pulledData.add(e);
}
+ private void pullProcessSystemIonHeapSize(
+ int tagId, long elapsedNanos, long wallClockNanos,
+ List<StatsLogEventWrapper> pulledData) {
+ // TODO(b/130526489): Read from debugfs.
+ }
+
private void pullBinderCallsStats(
int tagId, long elapsedNanos, long wallClockNanos,
List<StatsLogEventWrapper> pulledData) {
@@ -2317,6 +2323,10 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
pullSystemIonHeapSize(tagId, elapsedNanos, wallClockNanos, ret);
break;
}
+ case StatsLog.PROCESS_SYSTEM_ION_HEAP_SIZE: {
+ pullProcessSystemIonHeapSize(tagId, elapsedNanos, wallClockNanos, ret);
+ break;
+ }
case StatsLog.BINDER_CALLS: {
pullBinderCallsStats(tagId, elapsedNanos, wallClockNanos, ret);
break;
diff --git a/services/core/java/com/android/server/utils/TimingsTraceAndSlog.java b/services/core/java/com/android/server/utils/TimingsTraceAndSlog.java
index 704881ad2496..03c96e99a5ad 100644
--- a/services/core/java/com/android/server/utils/TimingsTraceAndSlog.java
+++ b/services/core/java/com/android/server/utils/TimingsTraceAndSlog.java
@@ -33,11 +33,25 @@ public final class TimingsTraceAndSlog extends TimingsTraceLog {
/**
* Tag for timing measurement of non-main asynchronous operations.
*/
- public static final String SYSTEM_SERVER_TIMING_ASYNC_TAG = SYSTEM_SERVER_TIMING_TAG + "Async";
+ private static final String SYSTEM_SERVER_TIMING_ASYNC_TAG = SYSTEM_SERVER_TIMING_TAG + "Async";
+
+ /**
+ * Set this to a positive value to get a {@Slog.w} log for any trace that took longer than it.
+ */
+ private static final long BOTTLENECK_DURATION_MS = -1;
private final String mTag;
/**
+ * Creates a new {@link TimingsTraceAndSlog} for async operations.
+ */
+ @NonNull
+ public static TimingsTraceAndSlog newAsyncLog() {
+ return new TimingsTraceAndSlog(SYSTEM_SERVER_TIMING_ASYNC_TAG,
+ Trace.TRACE_TAG_SYSTEM_SERVER);
+ }
+
+ /**
* Default constructor using {@code system_server} tags.
*/
public TimingsTraceAndSlog() {
@@ -60,4 +74,17 @@ public final class TimingsTraceAndSlog extends TimingsTraceLog {
Slog.i(mTag, name);
super.traceBegin(name);
}
+
+ @Override
+ public void logDuration(String name, long timeMs) {
+ super.logDuration(name, timeMs);
+ if (BOTTLENECK_DURATION_MS > 0 && timeMs >= BOTTLENECK_DURATION_MS) {
+ Slog.w(mTag, "Slow duration for " + name + ": " + timeMs + "ms");
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "TimingsTraceAndSlog[" + mTag + "]";
+ }
}
diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
index f76d0ebecf54..cf4f0a699968 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
@@ -246,7 +246,6 @@ import com.android.internal.util.FastPrintWriter;
import com.android.internal.util.Preconditions;
import com.android.internal.util.function.pooled.PooledLambda;
import com.android.server.AttributeCache;
-import com.android.server.DeviceIdleController;
import com.android.server.LocalServices;
import com.android.server.SystemService;
import com.android.server.SystemServiceManager;
@@ -434,9 +433,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
private static final long START_AS_CALLER_TOKEN_EXPIRED_TIMEOUT =
START_AS_CALLER_TOKEN_TIMEOUT_IMPL + 20 * MINUTE_IN_MILLIS;
- // How long to whitelist the Services for when requested.
- private static final int SERVICE_LAUNCH_IDLE_WHITELIST_DURATION_MS = 5 * 1000;
-
// Activity tokens of system activities that are delegating their call to
// #startActivityByCaller, keyed by the permissionToken granted to the delegate.
final HashMap<IBinder, IBinder> mStartActivitySources = new HashMap<>();
@@ -3079,9 +3075,9 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
try {
if (TextUtils.equals(pae.intent.getAction(),
android.service.voice.VoiceInteractionService.SERVICE_INTERFACE)) {
- pae.intent.putExtras(pae.extras);
-
- startVoiceInteractionServiceAsUser(pae.intent, pae.userHandle, "AssistContext");
+ // Start voice interaction through VoiceInteractionManagerService.
+ mAssistUtils.showSessionForActiveService(sendBundle, SHOW_SOURCE_APPLICATION,
+ null, null);
} else {
pae.intent.replaceExtras(pae.extras);
pae.intent.setFlags(FLAG_ACTIVITY_NEW_TASK
@@ -3100,34 +3096,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
}
}
- /**
- * Workaround for historical API which starts the Assist service with a non-foreground
- * {@code startService()} call.
- */
- private void startVoiceInteractionServiceAsUser(
- Intent intent, int userHandle, String reason) {
- // Resolve the intent to find out which package we need to whitelist.
- ResolveInfo resolveInfo =
- mContext.getPackageManager().resolveServiceAsUser(intent, 0, userHandle);
- if (resolveInfo == null || resolveInfo.serviceInfo == null) {
- Slog.e(TAG, "VoiceInteractionService intent does not resolve. Not starting.");
- return;
- }
- intent.setPackage(resolveInfo.serviceInfo.packageName);
-
- // Whitelist background services temporarily.
- LocalServices.getService(DeviceIdleController.LocalService.class)
- .addPowerSaveTempWhitelistApp(Process.myUid(), intent.getPackage(),
- SERVICE_LAUNCH_IDLE_WHITELIST_DURATION_MS, userHandle, false, reason);
-
- // Finally, try to start the service.
- try {
- mContext.startServiceAsUser(intent, UserHandle.of(userHandle));
- } catch (RuntimeException e) {
- Slog.e(TAG, "VoiceInteractionService failed to start.", e);
- }
- }
-
@Override
public int addAppTask(IBinder activityToken, Intent intent,
ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java
index 918927912c0b..be3b924aaeb7 100644
--- a/services/core/java/com/android/server/wm/AppWindowToken.java
+++ b/services/core/java/com/android/server/wm/AppWindowToken.java
@@ -79,6 +79,7 @@ import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_NORMAL;
import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_WILL_PLACE_SURFACES;
import static com.android.server.wm.WindowManagerService.logWithStack;
import static com.android.server.wm.WindowState.LEGACY_POLICY_VISIBILITY;
+import static com.android.server.wm.WindowStateAnimator.HAS_DRAWN;
import static com.android.server.wm.WindowStateAnimator.STACK_CLIP_AFTER_ANIM;
import static com.android.server.wm.WindowStateAnimator.STACK_CLIP_BEFORE_ANIM;
@@ -540,6 +541,14 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
// If the app was already visible, don't reset the waitingToShow state.
if (isHidden()) {
waitingToShow = true;
+
+ // Let's reset the draw state in order to prevent the starting window to be
+ // immediately dismissed when the app still has the surface.
+ forAllWindows(w -> {
+ if (w.mWinAnimator.mDrawState == HAS_DRAWN) {
+ w.mWinAnimator.resetDrawState();
+ }
+ }, true /* traverseTopToBottom */);
}
}
diff --git a/services/core/java/com/android/server/wm/InputMonitor.java b/services/core/java/com/android/server/wm/InputMonitor.java
index d3dba90fe4e6..2eec92680ffc 100644
--- a/services/core/java/com/android/server/wm/InputMonitor.java
+++ b/services/core/java/com/android/server/wm/InputMonitor.java
@@ -321,11 +321,10 @@ final class InputMonitor {
}
void updateInputWindowsImmediately() {
- if (mUpdateInputWindowsPending) {
- mApplyImmediately = true;
- mUpdateInputWindows.run();
- mApplyImmediately = false;
- }
+ mHandler.removeCallbacks(mUpdateInputWindows);
+ mApplyImmediately = true;
+ mUpdateInputWindows.run();
+ mApplyImmediately = false;
}
/* Called when the current input focus changes.
diff --git a/services/core/java/com/android/server/wm/RecentTasks.java b/services/core/java/com/android/server/wm/RecentTasks.java
index e0ab72271745..541a8bbc8865 100644
--- a/services/core/java/com/android/server/wm/RecentTasks.java
+++ b/services/core/java/com/android/server/wm/RecentTasks.java
@@ -308,11 +308,13 @@ class RecentTasks {
*/
@VisibleForTesting
void resetFreezeTaskListReorderingOnTimeout() {
- final ActivityStack focusedStack = mService.getTopDisplayFocusedStack();
- final TaskRecord topTask = focusedStack != null
- ? focusedStack.topTask()
- : null;
- resetFreezeTaskListReordering(topTask);
+ synchronized (mService.mGlobalLock) {
+ final ActivityStack focusedStack = mService.getTopDisplayFocusedStack();
+ final TaskRecord topTask = focusedStack != null
+ ? focusedStack.topTask()
+ : null;
+ resetFreezeTaskListReordering(topTask);
+ }
}
@VisibleForTesting
diff --git a/services/core/java/com/android/server/wm/Session.java b/services/core/java/com/android/server/wm/Session.java
index ecb0941b4bd0..8d1cc71f7a6f 100644
--- a/services/core/java/com/android/server/wm/Session.java
+++ b/services/core/java/com/android/server/wm/Session.java
@@ -28,6 +28,7 @@ import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_TASK_POSITION
import static com.android.server.wm.WindowManagerDebugConfig.SHOW_TRANSACTIONS;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
+import android.annotation.Nullable;
import android.content.ClipData;
import android.graphics.Rect;
import android.graphics.Region;
@@ -225,10 +226,11 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient {
}
@Override
- public void finishDrawing(IWindow window) {
+ public void finishDrawing(IWindow window,
+ @Nullable SurfaceControl.Transaction postDrawTransaction) {
if (WindowManagerService.localLOGV) Slog.v(
TAG_WM, "IWindow finishDrawing called for " + window);
- mService.finishDrawingWindow(this, window);
+ mService.finishDrawingWindow(this, window, postDrawTransaction);
}
@Override
diff --git a/services/core/java/com/android/server/wm/TaskSnapshotController.java b/services/core/java/com/android/server/wm/TaskSnapshotController.java
index 181521850369..101c4b86fbfa 100644
--- a/services/core/java/com/android/server/wm/TaskSnapshotController.java
+++ b/services/core/java/com/android/server/wm/TaskSnapshotController.java
@@ -306,7 +306,8 @@ class TaskSnapshotController {
final boolean isWindowTranslucent = mainWindow.getAttrs().format != PixelFormat.OPAQUE;
return new TaskSnapshot(
appWindowToken.mActivityComponent, screenshotBuffer.getGraphicBuffer(),
- screenshotBuffer.getColorSpace(), appWindowToken.getConfiguration().orientation,
+ screenshotBuffer.getColorSpace(),
+ appWindowToken.getTask().getConfiguration().orientation,
getInsets(mainWindow), isLowRamDevice /* reduced */, scaleFraction /* scale */,
true /* isRealSnapshot */, task.getWindowingMode(), getSystemUiVisibility(task),
!appWindowToken.fillsParent() || isWindowTranslucent);
@@ -379,8 +380,8 @@ class TaskSnapshotController {
final LayoutParams attrs = mainWindow.getAttrs();
final SystemBarBackgroundPainter decorPainter = new SystemBarBackgroundPainter(attrs.flags,
attrs.privateFlags, attrs.systemUiVisibility, task.getTaskDescription());
- final int width = mainWindow.getFrameLw().width();
- final int height = mainWindow.getFrameLw().height();
+ final int width = task.getBounds().width();
+ final int height = task.getBounds().height();
final RenderNode node = RenderNode.create("TaskSnapshotController", null);
node.setLeftTopRightBottom(0, 0, width, height);
@@ -394,11 +395,12 @@ class TaskSnapshotController {
if (hwBitmap == null) {
return null;
}
+
// Note, the app theme snapshot is never translucent because we enforce a non-translucent
// color above
return new TaskSnapshot(topChild.mActivityComponent, hwBitmap.createGraphicBufferHandle(),
- hwBitmap.getColorSpace(), topChild.getConfiguration().orientation,
- mainWindow.getStableInsets(), ActivityManager.isLowRamDeviceStatic() /* reduced */,
+ hwBitmap.getColorSpace(), topChild.getTask().getConfiguration().orientation,
+ getInsets(mainWindow), ActivityManager.isLowRamDeviceStatic() /* reduced */,
1.0f /* scale */, false /* isRealSnapshot */, task.getWindowingMode(),
getSystemUiVisibility(task), false);
}
diff --git a/services/core/java/com/android/server/wm/TaskSnapshotSurface.java b/services/core/java/com/android/server/wm/TaskSnapshotSurface.java
index 5d99db5a00de..306e7f44102e 100644
--- a/services/core/java/com/android/server/wm/TaskSnapshotSurface.java
+++ b/services/core/java/com/android/server/wm/TaskSnapshotSurface.java
@@ -418,7 +418,7 @@ class TaskSnapshotSurface implements StartingSurface {
private void reportDrawn() {
try {
- mSession.finishDrawing(mWindow);
+ mSession.finishDrawing(mWindow, null /* postDrawTransaction */);
} catch (RemoteException e) {
// Local call.
}
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index 0019d606764a..10f09227a186 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -100,6 +100,7 @@ import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
import static com.android.server.wm.WindowManagerServiceDumpProto.DISPLAY_FROZEN;
import static com.android.server.wm.WindowManagerServiceDumpProto.FOCUSED_APP;
+import static com.android.server.wm.WindowManagerServiceDumpProto.FOCUSED_DISPLAY_ID;
import static com.android.server.wm.WindowManagerServiceDumpProto.FOCUSED_WINDOW;
import static com.android.server.wm.WindowManagerServiceDumpProto.INPUT_METHOD_WINDOW;
import static com.android.server.wm.WindowManagerServiceDumpProto.LAST_ORIENTATION;
@@ -2356,14 +2357,15 @@ public class WindowManagerService extends IWindowManager.Stub
}
}
- void finishDrawingWindow(Session session, IWindow client) {
+ void finishDrawingWindow(Session session, IWindow client,
+ @Nullable SurfaceControl.Transaction postDrawTransaction) {
final long origId = Binder.clearCallingIdentity();
try {
synchronized (mGlobalLock) {
WindowState win = windowForClientLocked(session, client, false);
if (DEBUG_ADD_REMOVE) Slog.d(TAG_WM, "finishDrawingWindow: " + win + " mDrawState="
+ (win != null ? win.mWinAnimator.drawStateToString() : "null"));
- if (win != null && win.mWinAnimator.finishDrawingLocked()) {
+ if (win != null && win.mWinAnimator.finishDrawingLocked(postDrawTransaction)) {
if ((win.mAttrs.flags & FLAG_SHOW_WALLPAPER) != 0) {
win.getDisplayContent().pendingLayoutChanges |=
WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
@@ -5929,6 +5931,7 @@ public class WindowManagerService extends IWindowManager.Stub
final DisplayContent defaultDisplayContent = getDefaultDisplayContentLocked();
proto.write(ROTATION, defaultDisplayContent.getRotation());
proto.write(LAST_ORIENTATION, defaultDisplayContent.getLastOrientation());
+ proto.write(FOCUSED_DISPLAY_ID, topFocusedDisplayContent.getDisplayId());
}
private void dumpWindowsLocked(PrintWriter pw, boolean dumpAll,
diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java
index dc94d16e1308..4cd6731fc5b4 100644
--- a/services/core/java/com/android/server/wm/WindowStateAnimator.java
+++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java
@@ -220,7 +220,16 @@ class WindowStateAnimator {
private final Rect mTmpSize = new Rect();
- private final SurfaceControl.Transaction mReparentTransaction = new SurfaceControl.Transaction();
+ /**
+ * Handles surface changes synchronized to after the client has drawn the surface. This
+ * transaction is currently used to reparent the old surface children to the new surface once
+ * the client has completed drawing to the new surface.
+ * This transaction is also used to merge transactions parceled in by the client. The client
+ * uses the transaction to update the relative z of its children from the old parent surface
+ * to the new parent surface once window manager reparents its children.
+ */
+ private final SurfaceControl.Transaction mPostDrawTransaction =
+ new SurfaceControl.Transaction();
// Used to track whether we have called detach children on the way to invisibility, in which
// case we need to give the client a new Surface if it lays back out to a visible state.
@@ -301,7 +310,7 @@ class WindowStateAnimator {
SurfaceControl.mergeToGlobalTransaction(mTmpTransaction);
}
- boolean finishDrawingLocked() {
+ boolean finishDrawingLocked(SurfaceControl.Transaction postDrawTransaction) {
final boolean startingWindow =
mWin.mAttrs.type == WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
if (DEBUG_STARTING_WINDOW && startingWindow) {
@@ -321,6 +330,9 @@ class WindowStateAnimator {
mDrawState = COMMIT_DRAW_PENDING;
layoutNeeded = true;
}
+ if (postDrawTransaction != null) {
+ mPostDrawTransaction.merge(postDrawTransaction);
+ }
return layoutNeeded;
}
@@ -385,7 +397,7 @@ class WindowStateAnimator {
// child layers need to be reparented to the new surface to make this
// transparent to the app.
if (mWin.mAppToken == null || mWin.mAppToken.isRelaunching() == false) {
- mReparentTransaction.reparentChildren(mPendingDestroySurface.mSurfaceControl,
+ mPostDrawTransaction.reparentChildren(mPendingDestroySurface.mSurfaceControl,
mSurfaceController.mSurfaceControl.getHandle())
.apply();
}
@@ -1150,7 +1162,7 @@ class WindowStateAnimator {
// LogicalDisplay.
mAnimator.setPendingLayoutChanges(w.getDisplayId(),
FINISH_LAYOUT_REDO_ANIM);
- if (DEBUG_LAYOUT_REPEATS) {
+ if (DEBUG_LAYOUT_REPEATS) {
mService.mWindowPlacerLocked.debugLayoutRepeats(
"showSurfaceRobustlyLocked " + w,
mAnimator.getPendingLayoutChanges(w.getDisplayId()));
@@ -1281,10 +1293,13 @@ class WindowStateAnimator {
// If we had a preserved surface it's no longer needed, and it may be harmful
// if we are transparent.
if (mPendingDestroySurface != null && mDestroyPreservedSurfaceUponRedraw) {
- mPendingDestroySurface.mSurfaceControl.hide();
- mPendingDestroySurface.reparentChildrenInTransaction(mSurfaceController);
+ final SurfaceControl pendingSurfaceControl = mPendingDestroySurface.mSurfaceControl;
+ mPostDrawTransaction.hide(pendingSurfaceControl);
+ mPostDrawTransaction.reparentChildren(pendingSurfaceControl,
+ mSurfaceController.getHandle());
}
+ mPostDrawTransaction.apply();
return true;
}
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index ba59cdbe7f59..8b61208c0b66 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -6443,7 +6443,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
.setAdmin(admin)
.setStrings(vpnPackage)
.setBoolean(lockdown)
- .setInt(/* number of vpn packages */ 0)
+ .setInt(lockdownWhitelist != null ? lockdownWhitelist.size() : 0)
.write();
} finally {
mInjector.binderRestoreCallingIdentity(token);
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 72ae9a352c2a..3ec8b2efa8a2 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -22,7 +22,6 @@ import static android.os.IServiceManager.DUMP_FLAG_PRIORITY_NORMAL;
import static android.os.IServiceManager.DUMP_FLAG_PROTO;
import static android.view.Display.DEFAULT_DISPLAY;
-import static com.android.server.utils.TimingsTraceAndSlog.SYSTEM_SERVER_TIMING_ASYNC_TAG;
import static com.android.server.utils.TimingsTraceAndSlog.SYSTEM_SERVER_TIMING_TAG;
import android.annotation.NonNull;
@@ -57,7 +56,6 @@ import android.os.ServiceManager;
import android.os.StrictMode;
import android.os.SystemClock;
import android.os.SystemProperties;
-import android.os.Trace;
import android.os.UserHandle;
import android.os.storage.IStorageManager;
import android.provider.DeviceConfig;
@@ -619,6 +617,8 @@ public final class SystemServer {
* initialized in one of the other functions.
*/
private void startBootstrapServices(@NonNull TimingsTraceAndSlog t) {
+ t.traceBegin("startBootstrapServices");
+
// Start the watchdog as early as possible so we can crash the system server
// if we deadlock during early boot
t.traceBegin("StartWatchdog");
@@ -710,7 +710,7 @@ public final class SystemServer {
// We need the default display before we can initialize the package manager.
t.traceBegin("WaitForDisplay");
- mSystemServiceManager.startBootPhase(SystemService.PHASE_WAIT_FOR_DEFAULT_DISPLAY);
+ mSystemServiceManager.startBootPhase(t, SystemService.PHASE_WAIT_FOR_DEFAULT_DISPLAY);
t.traceEnd();
// Only run "core" apps if we're encrypting the device.
@@ -809,18 +809,21 @@ public final class SystemServer {
// Start sensor service in a separate thread. Completion should be checked
// before using it.
mSensorServiceStart = SystemServerInitThreadPool.get().submit(() -> {
- TimingsTraceAndSlog traceLog = new TimingsTraceAndSlog(
- SYSTEM_SERVER_TIMING_ASYNC_TAG, Trace.TRACE_TAG_SYSTEM_SERVER);
+ TimingsTraceAndSlog traceLog = TimingsTraceAndSlog.newAsyncLog();
traceLog.traceBegin(START_SENSOR_SERVICE);
startSensorService();
traceLog.traceEnd();
}, START_SENSOR_SERVICE);
+
+ t.traceEnd(); // startBootstrapServices
}
/**
* Starts some essential services that are not tangled up in the bootstrap process.
*/
private void startCoreServices(@NonNull TimingsTraceAndSlog t) {
+ t.traceBegin("startCoreServices");
+
t.traceBegin("StartBatteryService");
// Tracks the battery level. Requires LightService.
mSystemServiceManager.startService(BatteryService.class);
@@ -869,12 +872,16 @@ public final class SystemServer {
t.traceBegin("GpuService");
mSystemServiceManager.startService(GpuService.class);
t.traceEnd();
+
+ t.traceEnd(); // startCoreServices
}
/**
* Starts a miscellaneous grab bag of stuff that has yet to be refactored and organized.
*/
private void startOtherServices(@NonNull TimingsTraceAndSlog t) {
+ t.traceBegin("startOtherServices");
+
final Context context = mSystemContext;
VibratorService vibrator = null;
DynamicSystemService dynamicSystem = null;
@@ -929,8 +936,7 @@ public final class SystemServer {
mZygotePreload = SystemServerInitThreadPool.get().submit(() -> {
try {
Slog.i(TAG, SECONDARY_ZYGOTE_PRELOAD);
- TimingsTraceAndSlog traceLog = new TimingsTraceAndSlog(
- SYSTEM_SERVER_TIMING_ASYNC_TAG, Trace.TRACE_TAG_SYSTEM_SERVER);
+ TimingsTraceAndSlog traceLog = TimingsTraceAndSlog.newAsyncLog();
traceLog.traceBegin(SECONDARY_ZYGOTE_PRELOAD);
if (!Process.ZYGOTE_PROCESS.preloadDefault(Build.SUPPORTED_32_BIT_ABIS[0])) {
Slog.e(TAG, "Unable to preload default resources");
@@ -1040,8 +1046,7 @@ public final class SystemServer {
// because it need to connect to SensorManager. This have to start
// after START_SENSOR_SERVICE is done.
SystemServerInitThreadPool.get().submit(() -> {
- TimingsTraceAndSlog traceLog = new TimingsTraceAndSlog(
- SYSTEM_SERVER_TIMING_ASYNC_TAG, Trace.TRACE_TAG_SYSTEM_SERVER);
+ TimingsTraceAndSlog traceLog = TimingsTraceAndSlog.newAsyncLog();
traceLog.traceBegin(START_HIDL_SERVICES);
startHidlServices();
traceLog.traceEnd();
@@ -1930,11 +1935,11 @@ public final class SystemServer {
// Needed by DevicePolicyManager for initialization
t.traceBegin("StartBootPhaseLockSettingsReady");
- mSystemServiceManager.startBootPhase(SystemService.PHASE_LOCK_SETTINGS_READY);
+ mSystemServiceManager.startBootPhase(t, SystemService.PHASE_LOCK_SETTINGS_READY);
t.traceEnd();
t.traceBegin("StartBootPhaseSystemServicesReady");
- mSystemServiceManager.startBootPhase(SystemService.PHASE_SYSTEM_SERVICES_READY);
+ mSystemServiceManager.startBootPhase(t, SystemService.PHASE_SYSTEM_SERVICES_READY);
t.traceEnd();
t.traceBegin("MakeWindowManagerServiceReady");
@@ -2004,7 +2009,7 @@ public final class SystemServer {
t.traceEnd();
t.traceBegin("StartBootPhaseDeviceSpecificServicesReady");
- mSystemServiceManager.startBootPhase(SystemService.PHASE_DEVICE_SPECIFIC_SERVICES_READY);
+ mSystemServiceManager.startBootPhase(t, SystemService.PHASE_DEVICE_SPECIFIC_SERVICES_READY);
t.traceEnd();
// Permission policy service
@@ -2035,8 +2040,7 @@ public final class SystemServer {
mActivityManagerService.systemReady(() -> {
Slog.i(TAG, "Making services ready");
t.traceBegin("StartActivityManagerReadyPhase");
- mSystemServiceManager.startBootPhase(
- SystemService.PHASE_ACTIVITY_MANAGER_READY);
+ mSystemServiceManager.startBootPhase(t, SystemService.PHASE_ACTIVITY_MANAGER_READY);
t.traceEnd();
t.traceBegin("StartObservingNativeCrashes");
try {
@@ -2053,8 +2057,7 @@ public final class SystemServer {
if (!mOnlyCore && mWebViewUpdateService != null) {
webviewPrep = SystemServerInitThreadPool.get().submit(() -> {
Slog.i(TAG, WEBVIEW_PREPARATION);
- TimingsTraceAndSlog traceLog = new TimingsTraceAndSlog(
- SYSTEM_SERVER_TIMING_ASYNC_TAG, Trace.TRACE_TAG_SYSTEM_SERVER);
+ TimingsTraceAndSlog traceLog = TimingsTraceAndSlog.newAsyncLog();
traceLog.traceBegin(WEBVIEW_PREPARATION);
ConcurrentUtils.waitForFutureNoInterrupt(mZygotePreload, "Zygote preload");
mZygotePreload = null;
@@ -2151,8 +2154,7 @@ public final class SystemServer {
if (webviewPrep != null) {
ConcurrentUtils.waitForFutureNoInterrupt(webviewPrep, WEBVIEW_PREPARATION);
}
- mSystemServiceManager.startBootPhase(
- SystemService.PHASE_THIRD_PARTY_APPS_CAN_START);
+ mSystemServiceManager.startBootPhase(t, SystemService.PHASE_THIRD_PARTY_APPS_CAN_START);
t.traceEnd();
t.traceBegin("StartNetworkStack");
@@ -2247,6 +2249,8 @@ public final class SystemServer {
}
t.traceEnd();
}, t);
+
+ t.traceEnd(); // startOtherServices
}
private void startSystemCaptionsManagerService(@NonNull Context context,
diff --git a/services/net/java/android/net/NetworkStackClient.java b/services/net/java/android/net/NetworkStackClient.java
index 99da637416c3..56b728c87180 100644
--- a/services/net/java/android/net/NetworkStackClient.java
+++ b/services/net/java/android/net/NetworkStackClient.java
@@ -486,7 +486,9 @@ public class NetworkStackClient {
private void requestConnector(@NonNull NetworkStackCallback request) {
// TODO: PID check.
final int caller = Binder.getCallingUid();
- if (caller != Process.SYSTEM_UID && !UserHandle.isSameApp(caller, Process.BLUETOOTH_UID)
+ if (caller != Process.SYSTEM_UID
+ && caller != Process.NETWORK_STACK_UID
+ && !UserHandle.isSameApp(caller, Process.BLUETOOTH_UID)
&& !UserHandle.isSameApp(caller, Process.PHONE_UID)) {
// Don't even attempt to obtain the connector and give a nice error message
throw new SecurityException(
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index e5971b8c0b9d..484fd3b17c02 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -3078,18 +3078,10 @@ public class SubscriptionManager {
}
/**
- * Returns whether the subscription is enabled or not. This is different from activated
- * or deactivated for two aspects. 1) For when user disables a physical subscription, we
- * actually disable the modem because we can't switch off the subscription. 2) For eSIM,
- * user may enable one subscription but the system may activate another temporarily. In this
- * case, user enabled one is different from current active one.
-
- * @param subscriptionId The subscription it asks about.
- * @return whether it's enabled or not. {@code true} if user set this subscription enabled
- * earlier, or user never set subscription enable / disable on this slot explicitly, and
- * this subscription is currently active. Otherwise, it returns {@code false}.
- *
+ * DO NOT USE.
+ * This API is designed for features that are not finished at this point. Do not call this API.
* @hide
+ * TODO b/135547512: further clean up
*/
@SystemApi
@RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
@@ -3107,14 +3099,10 @@ public class SubscriptionManager {
}
/**
- * Get which subscription is enabled on this slot. See {@link #isSubscriptionEnabled(int)}
- * for more details.
- *
- * @param slotIndex which slot it asks about.
- * @return which subscription is enabled on this slot. If there's no enabled subscription
- * in this slot, it will return {@link SubscriptionManager#INVALID_SUBSCRIPTION_ID}.
- *
+ * DO NOT USE.
+ * This API is designed for features that are not finished at this point. Do not call this API.
* @hide
+ * TODO b/135547512: further clean up
*/
@SystemApi
@RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 9a0f3ca95f5f..8517b769d2a5 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -4911,7 +4911,8 @@ public class TelephonyManager {
ITelephony telephony = getITelephony();
if (telephony == null)
return DATA_ACTIVITY_NONE;
- return telephony.getDataActivity();
+ return telephony.getDataActivity(
+ getSubId(SubscriptionManager.getActiveDataSubscriptionId()));
} catch (RemoteException ex) {
// the phone process is restarting.
return DATA_ACTIVITY_NONE;
@@ -4959,7 +4960,8 @@ public class TelephonyManager {
ITelephony telephony = getITelephony();
if (telephony == null)
return DATA_DISCONNECTED;
- return telephony.getDataState();
+ return telephony.getDataState(
+ getSubId(SubscriptionManager.getActiveDataSubscriptionId()));
} catch (RemoteException ex) {
// the phone process is restarting.
return DATA_DISCONNECTED;
diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl
index 5a27a0fb42e4..e23cd6843162 100644
--- a/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl
@@ -308,18 +308,36 @@ interface ITelephony {
*/
List<NeighboringCellInfo> getNeighboringCellInfo(String callingPkg);
- @UnsupportedAppUsage
- int getCallState();
+ @UnsupportedAppUsage
+ int getCallState();
/**
* Returns the call state for a slot.
*/
int getCallStateForSlot(int slotIndex);
- @UnsupportedAppUsage
- int getDataActivity();
- @UnsupportedAppUsage
- int getDataState();
+ /**
+ * Returns a constant indicating the type of activity on a data connection
+ * (cellular).
+ *
+ * @see #DATA_ACTIVITY_NONE
+ * @see #DATA_ACTIVITY_IN
+ * @see #DATA_ACTIVITY_OUT
+ * @see #DATA_ACTIVITY_INOUT
+ * @see #DATA_ACTIVITY_DORMANT
+ */
+ int getDataActivity(int subId);
+
+ /**
+ * Returns a constant indicating the current data connection state
+ * (cellular).
+ *
+ * @see #DATA_DISCONNECTED
+ * @see #DATA_CONNECTING
+ * @see #DATA_CONNECTED
+ * @see #DATA_SUSPENDED
+ */
+ int getDataState(int subId);
/**
* Returns the current active phone type as integer.
diff --git a/tests/net/java/android/net/util/KeepaliveUtilsTest.kt b/tests/net/java/android/net/util/KeepaliveUtilsTest.kt
index 814e06e311b3..8ea226db938e 100644
--- a/tests/net/java/android/net/util/KeepaliveUtilsTest.kt
+++ b/tests/net/java/android/net/util/KeepaliveUtilsTest.kt
@@ -78,7 +78,6 @@ class KeepaliveUtilsTest {
assertRunWithException(arrayOf("5"))
// Check resource with invalid slots value.
- assertRunWithException(arrayOf("2,2"))
assertRunWithException(arrayOf("3,-1"))
// Check resource with invalid transport type.