Merge "Allow LayoutLibLoader customization."
diff --git a/Android.bp b/Android.bp
index 8fedc34..1902a5f 100644
--- a/Android.bp
+++ b/Android.bp
@@ -747,7 +747,7 @@
"core/java/android/content/pm/AndroidTestBaseUpdater.java",
],
- no_framework_libs: true,
+ sdk_version: "core_platform",
libs: [
"ext",
"updatable_media_stubs",
@@ -951,7 +951,7 @@
java_library {
name: "ext",
installable: true,
- no_framework_libs: true,
+ sdk_version: "core_platform",
static_libs: [
"libphonenumber-platform",
"nist-sip",
@@ -1175,7 +1175,7 @@
// 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 @@
"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 4715212..28fe8bb 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -23977,6 +23977,7 @@
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 d541169..f925023 100644
--- a/cmds/app_process/Android.bp
+++ b/cmds/app_process/Android.bp
@@ -21,6 +21,7 @@
"libbinder",
"libcutils",
"libdl",
+ "libhidlbase",
"libhwbinder",
"liblog",
"libnativeloader",
diff --git a/cmds/statsd/Android.bp b/cmds/statsd/Android.bp
index 6bedfcd..2f0dc3c 100644
--- a/cmds/statsd/Android.bp
+++ b/cmds/statsd/Android.bp
@@ -333,7 +333,7 @@
// ==== 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 ad0fe27..19374a58 100644
--- a/cmds/statsd/src/atoms.proto
+++ b/cmds/statsd/src/atoms.proto
@@ -312,7 +312,7 @@
}
// 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 @@
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 @@
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 914d60d..475f18a 100644
--- a/cmds/statsd/src/external/StatsPullerManager.cpp
+++ b/cmds/statsd/src/external/StatsPullerManager.cpp
@@ -156,6 +156,9 @@
// 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 4db3725..ac8b604 100644
--- a/core/java/android/app/INotificationManager.aidl
+++ b/core/java/android/app/INotificationManager.aidl
@@ -108,6 +108,8 @@
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 2e80375..c1cee77 100644
--- a/core/java/android/app/NotificationManager.java
+++ b/core/java/android/app/NotificationManager.java
@@ -1133,6 +1133,25 @@
}
/**
+ * 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 31bbd16..39d63de 100644
--- a/core/java/android/bluetooth/BluetoothAdapter.java
+++ b/core/java/android/bluetooth/BluetoothAdapter.java
@@ -1028,7 +1028,8 @@
*/
@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 @@
* @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 388161d..c616044 100644
--- a/core/java/android/bluetooth/BluetoothDevice.java
+++ b/core/java/android/bluetooth/BluetoothDevice.java
@@ -1051,7 +1051,7 @@
* @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 @@
* @see #getAlias()
* @see #getName()
*/
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(publicAlternatives = "Use {@link #getName()} instead.")
public String getAliasName() {
String name = getAlias();
if (name == null) {
@@ -1975,7 +1975,8 @@
* 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 c06b837..3a23808 100644
--- a/core/java/android/bluetooth/BluetoothServerSocket.java
+++ b/core/java/android/bluetooth/BluetoothServerSocket.java
@@ -77,7 +77,8 @@
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 3a1e2f5..a6e3153 100644
--- a/core/java/android/bluetooth/BluetoothSocket.java
+++ b/core/java/android/bluetooth/BluetoothSocket.java
@@ -131,7 +131,7 @@
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 46eddde..ec73866 100644
--- a/core/java/android/net/SocketKeepalive.java
+++ b/core/java/android/net/SocketKeepalive.java
@@ -44,9 +44,11 @@
* {@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 569fed1..bfc4563 100644
--- a/core/java/android/net/util/KeepaliveUtils.java
+++ b/core/java/android/net/util/KeepaliveUtils.java
@@ -34,9 +34,6 @@
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 @@
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 8512a0b..905c781 100644
--- a/core/java/android/service/notification/StatusBarNotification.java
+++ b/core/java/android/service/notification/StatusBarNotification.java
@@ -20,6 +20,7 @@
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 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 @@
/**
* Returns true if application asked that this notification be part of a group.
+ *
* @hide
*/
public boolean isAppGroup() {
@@ -203,18 +207,16 @@
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 @@
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 @@
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 @@
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 @@
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 @@
/**
* The ID passed to setGroup(), or the override, or null.
+ *
* @hide
*/
public String getGroup() {
@@ -398,10 +408,11 @@
/**
* 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 @@
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 @@
}
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 d645e3f..60dbf84 100644
--- a/core/java/android/service/wallpaper/WallpaperService.java
+++ b/core/java/android/service/wallpaper/WallpaperService.java
@@ -105,7 +105,7 @@
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 @@
private final ArrayList<Engine> mActiveEngines
= new ArrayList<Engine>();
-
+
static final class WallpaperCommand {
String action;
int x;
@@ -145,7 +145,7 @@
*/
public class Engine {
IWallpaperEngineWrapper mIWallpaperEngine;
-
+
// Copies from mIWallpaperEngine.
HandlerCaller mCaller;
IWallpaperConnection mConnection;
@@ -155,7 +155,7 @@
boolean mVisible;
boolean mReportedVisible;
boolean mDestroyed;
-
+
// Current window state.
boolean mCreated;
boolean mSurfaceCreated;
@@ -258,7 +258,7 @@
}
super.setFixedSize(width, height);
}
-
+
public void setKeepScreenOn(boolean screenOn) {
throw new UnsupportedOperationException(
"Wallpapers do not support keep screen on");
@@ -403,14 +403,14 @@
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 int getDesiredMinimumWidth() {
return mIWallpaperEngine.mReqWidth;
}
-
+
/**
* Convenience for {@link WallpaperManager#getDesiredMinimumHeight()
* WallpaperManager.getDesiredMinimumHeight()}, returning the height
@@ -437,7 +437,7 @@
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 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 @@
* {@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 @@
}
mLayout.format = mFormat;
-
+
mCurWindowFlags = mWindowFlags;
mLayout.flags = mWindowFlags
| WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
@@ -1020,7 +1020,7 @@
mIsCreating = false;
mSurfaceCreated = true;
if (redrawNeeded) {
- mSession.finishDrawing(mWindow);
+ mSession.finishDrawing(mWindow, null /* postDrawTransaction */);
}
mIWallpaperEngine.reportShown();
}
@@ -1045,7 +1045,7 @@
mSurfaceHolder.setSizeFromLayout();
mInitializing = true;
mSession = WindowManagerGlobal.getWindowSession();
-
+
mWindow.setSession(mSession);
mLayout.packageName = getPackageName();
@@ -1149,7 +1149,7 @@
}
}
}
-
+
void doOffsetsChanged(boolean always) {
if (mDestroyed) {
return;
@@ -1187,7 +1187,7 @@
mOffsetsChanged = true;
}
}
-
+
if (sync) {
try {
if (DEBUG) Log.v(TAG, "Reporting offsets change complete");
@@ -1196,7 +1196,7 @@
}
}
}
-
+
void doCommand(WallpaperCommand cmd) {
Bundle result;
if (!mDestroyed) {
@@ -1213,7 +1213,7 @@
}
}
}
-
+
void reportSurfaceDestroyed() {
if (mSurfaceCreated) {
mSurfaceCreated = false;
@@ -1229,12 +1229,12 @@
onSurfaceDestroyed(mSurfaceHolder);
}
}
-
+
void detach() {
if (mDestroyed) {
return;
}
-
+
mDestroyed = true;
if (mIWallpaperEngine.mDisplayManager != null) {
@@ -1246,9 +1246,9 @@
if (DEBUG) Log.v(TAG, "onVisibilityChanged(false): " + this);
onVisibilityChanged(false);
}
-
+
reportSurfaceDestroyed();
-
+
if (DEBUG) Log.v(TAG, "onDestroy(): " + this);
onDestroy();
@@ -1256,18 +1256,18 @@
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 3e6f09b..bc21722 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 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 caab00c..37b6f13 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.InsetsState;
import android.view.Surface;
import android.view.SurfaceControl;
+import android.view.Transaction;
import java.util.List;
@@ -57,7 +58,7 @@
* 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 @@
*/
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 bb169e0..c1633ae5 100644
--- a/core/java/android/view/SurfaceControl.java
+++ b/core/java/android/view/SurfaceControl.java
@@ -2693,6 +2693,14 @@
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 3535447..4891b43c 100644
--- a/core/java/android/view/SurfaceView.java
+++ b/core/java/android/view/SurfaceView.java
@@ -98,7 +98,8 @@
* 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 @@
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 @@
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 @@
// the SurfaceHolder forward, most live wallpapers do it.
if (viewRoot != null) {
viewRoot.removeWindowStoppedCallback(this);
+ viewRoot.removeSurfaceChangedCallback(this);
}
mAttachedToWindow = false;
@@ -637,21 +650,34 @@
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 @@
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 30bb2bb..16de906 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -68,6 +68,7 @@
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 @@
@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 @@
}
}
- /**
- * 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);
+ }
- mBoundsSurfaceControl = new SurfaceControl.Builder(mSurfaceSession)
+ 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);
+ }
+ }
+
+ /**
+ * 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 @@
}
if (surfaceSizeChanged) {
- updateBoundsSurface();
+ updateBoundsLayer();
}
final boolean didLayout = layoutRequested && (!mStopped || mReportNextDraw);
@@ -3438,7 +3452,9 @@
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 @@
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 @@
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 @@
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 f9cdf3d..dfd6f95 100644
--- a/core/java/com/android/internal/view/BaseIWindow.java
+++ b/core/java/com/android/internal/view/BaseIWindow.java
@@ -49,7 +49,7 @@
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 f55f81d..f55077a 100644
--- a/core/jni/android_view_SurfaceControl.cpp
+++ b/core/jni/android_view_SurfaceControl.cpp
@@ -1266,6 +1266,7 @@
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 0cd3dbf..834dd03 100644
--- a/core/jni/com_android_internal_os_Zygote.cpp
+++ b/core/jni/com_android_internal_os_Zygote.cpp
@@ -292,6 +292,7 @@
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 @@
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 @@
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 @@
// 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 @@
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 4874c41..4b6a6de 100644
--- a/core/proto/android/app/settings_enums.proto
+++ b/core/proto/android/app/settings_enums.proto
@@ -2380,6 +2380,11 @@
// 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 c0ac2cb..4136239 100644
--- a/core/proto/android/server/connectivity/Android.bp
+++ b/core/proto/android/server/connectivity/Android.bp
@@ -21,5 +21,4 @@
"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 e6ae226..7779025 100644
--- a/core/proto/android/server/windowmanagerservice.proto
+++ b/core/proto/android/server/windowmanagerservice.proto
@@ -45,6 +45,7 @@
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 5aa4ddb..5d642d38 100644
--- a/core/proto/android/stats/connectivity/Android.bp
+++ b/core/proto/android/stats/connectivity/Android.bp
@@ -21,5 +21,4 @@
"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 6ae54e2..5fb278a 100644
--- a/core/proto/android/stats/devicepolicy/Android.bp
+++ b/core/proto/android/stats/devicepolicy/Android.bp
@@ -29,5 +29,5 @@
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 0b5aa86..1e8c763 100644
--- a/core/proto/android/stats/dnsresolver/Android.bp
+++ b/core/proto/android/stats/dnsresolver/Android.bp
@@ -21,5 +21,4 @@
"dns_resolver.proto",
],
sdk_version: "system_current",
- no_framework_libs: true,
}
diff --git a/core/res/Android.bp b/core/res/Android.bp
index 4e60f8c..3402033 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 55d80ac..1a79adc 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 0f32a82..6161108 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 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 @@
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 @@
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 77d0552..f76471c 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 @@
/**
* 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 @@
});
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 76c8c62..5f5e908 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 a305d48..1d735af 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 a640122..ff4e100 100644
--- a/data/etc/privapp-permissions-platform.xml
+++ b/data/etc/privapp-permissions-platform.xml
@@ -185,6 +185,7 @@
<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 1d06348..ddced59 100644
--- a/graphics/proto/Android.bp
+++ b/graphics/proto/Android.bp
@@ -5,7 +5,6 @@
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 70dacb2..4f9671f 100644
--- a/media/Android.bp
+++ b/media/Android.bp
@@ -27,7 +27,7 @@
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 5645ba5..7ae6a02 100644
--- a/media/java/android/media/ExifInterface.java
+++ b/media/java/android/media/ExifInterface.java
@@ -367,6 +367,8 @@
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 @@
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 74fd525..2dc0d57 100644
--- a/media/proto/Android.bp
+++ b/media/proto/Android.bp
@@ -5,7 +5,6 @@
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 d946fbc..467c4a4 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 16b0125..ed5ab6a 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 @@
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 @@
}
);
- 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 @@
}
});
+ mEnableHeadsUpNotificationWhenNotificationShadeOpen = mContext.getResources().getBoolean(
+ R.bool.config_enableHeadsUpNotificationWhenNotificationShadeOpen);
CarHeadsUpNotificationManager carHeadsUpNotificationManager =
new CarSystemUIHeadsUpNotificationManager(mContext,
mNotificationClickHandlerFactory, mNotificationDataManager);
@@ -1273,11 +1276,18 @@
}
@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 797656e..3e42706 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 05c2f24..ca2d1ed 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_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 @@
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 @@
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 31925ab..aced5ef 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 @@
/**
* 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 2cbd788..60435d0 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 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 e19fe07..c36f81d 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 @@
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 void onFinishedGoingToSleep() {
mNotificationPanel.onAffordanceLaunchEnded();
releaseGestureWakeLock();
- mLaunchCameraOnScreenTurningOn = false;
+ mLaunchCameraWhenFinishedWaking = false;
mDeviceInteractive = false;
mWakeUpComingFromTouch = false;
mWakeUpTouchLocation = null;
@@ -3644,6 +3644,11 @@
@Override
public void onFinishedWakingUp() {
mWakeUpCoordinator.setWakingUp(false);
+ if (mLaunchCameraWhenFinishedWaking) {
+ mNotificationPanel.launchCamera(false /* animate */, mLastCameraLaunchSource);
+ mLaunchCameraWhenFinishedWaking = false;
+ }
+ updateScrimController();
}
};
@@ -3665,13 +3670,6 @@
public void onScreenTurningOn() {
mFalsingManager.onScreenTurningOn();
mNotificationPanel.onScreenTurningOn();
-
- if (mLaunchCameraOnScreenTurningOn) {
- mNotificationPanel.launchCamera(false, mLastCameraLaunchSource);
- mLaunchCameraOnScreenTurningOn = false;
- }
-
- updateScrimController();
}
@Override
@@ -3772,7 +3770,7 @@
// 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 @@
// 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 @@
== 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 @@
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 7b119a7..65bccbb 100644
--- a/proto/Android.bp
+++ b/proto/Android.bp
@@ -5,7 +5,6 @@
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 @@
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 0f0e6f9..c58e929 100644
--- a/proto/src/metrics_constants/metrics_constants.proto
+++ b/proto/src/metrics_constants/metrics_constants.proto
@@ -7388,6 +7388,20 @@
// 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 c5b4966..9711152e 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 @@
* 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 @@
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 @@
+ 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 @@
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 @@
+ " 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 0eb3a84..59589cd2 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.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 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 @@
// 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 @@
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 @@
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 aa2a086..1c53b9e 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 @@
}
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 @@
}
// 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 @@
if (goingCallback != null) {
goingCallback.run();
}
+ t.traceEnd(); // PhaseActivityManagerReady
return;
}
+ t.traceBegin("controllersReady");
mLocalDeviceIdleController
= LocalServices.getService(DeviceIdleController.LocalService.class);
mActivityTaskManager.onSystemReady();
@@ -8876,6 +8879,7 @@
mUserController.onSystemReady();
mAppOpsService.systemReady();
mSystemReady = true;
+ t.traceEnd();
}
try {
@@ -8884,6 +8888,7 @@
.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 @@
// 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();
- mUgmInternal.onSystemReady();
+ 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 @@
} 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 @@
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 @@
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 @@
} 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);
}
- mAtmInternal.resumeTopActivities(false /* scheduleIdle */);
- mUserController.sendUserSwitchBroadcasts(-1, currentUserId);
+ t.traceBegin("resumeTopActivities");
+ mAtmInternal.resumeTopActivities(false /* scheduleIdle */);
+ 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 a7d347b..d4ceb5a 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.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.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 @@
* <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 @@
}
}
+ @Override
public boolean handleMessage(Message msg) {
switch (msg.what) {
case START_USER_SWITCH_FG_MSG:
@@ -2159,7 +2160,8 @@
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 @@
// 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 626d724..9bae902 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 @@
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 750a4de..433ce81 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 @@
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 c3188c8..83c9c73 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 @@
}
@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 adcd19e..b3b0029 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 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 311739a..ef115f0 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.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 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
// 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 @@
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 @@
}
} // 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 @@
mServiceStartWithDelay = SystemClock.uptimeMillis() + (60 * 1000L);
- Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER);
+ t.traceEnd(); // "create package manager"
}
/**
@@ -10320,7 +10333,9 @@
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 @@
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 829dd0f..f4ba449 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 @@
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 @@
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 @@
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 03c7789..db01d77 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 @@
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 @@
// 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 @@
// Maps
grantPermissionsToSystemPackage(
getDefaultSystemHandlerActivityPackageForCategory(Intent.CATEGORY_APP_MAPS, userId),
- userId, LOCATION_PERMISSIONS);
+ userId, ALWAYS_LOCATION_PERMISSIONS);
// Gallery
grantPermissionsToSystemPackage(
@@ -609,14 +604,14 @@
}
}
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 @@
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 @@
.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 @@
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 @@
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 @@
}
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 @@
// 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 @@
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 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 5456d38..74ab2a9 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.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 @@
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 @@
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 63439d5..1134853 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 @@
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 @@
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 704881a..03c96e9 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 @@
/**
* 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 @@
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 f76d0eb..cf4f0a6 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.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 @@
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 @@
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 @@
}
}
- /**
- * 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 9189279..be3b924 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_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 @@
// 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 d3dba90..2eec926 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 @@
}
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 e0ab722..541a8bb 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 @@
*/
@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 ecb0941..8d1cc71 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.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 @@
}
@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 1815218..101c4b8 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 @@
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 @@
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 @@
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 5d99db5..306e7f4 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 @@
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 0019d60..10f0922 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_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 @@
}
}
- 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 @@
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 dc94d16..4cd6731 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 @@
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 @@
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 @@
mDrawState = COMMIT_DRAW_PENDING;
layoutNeeded = true;
}
+ if (postDrawTransaction != null) {
+ mPostDrawTransaction.merge(postDrawTransaction);
+ }
return layoutNeeded;
}
@@ -385,7 +397,7 @@
// 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 @@
// 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 @@
// 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 ba59cdb..8b61208 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 @@
.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 72ae9a3..3ec8b2e 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_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.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 @@
* 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 @@
// 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 @@
// 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 @@
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 @@
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 @@
// 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 @@
// 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 @@
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 @@
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 @@
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 @@
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 @@
}
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 99da637..56b728c 100644
--- a/services/net/java/android/net/NetworkStackClient.java
+++ b/services/net/java/android/net/NetworkStackClient.java
@@ -486,7 +486,9 @@
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 e5971b8..484fd3b 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -3078,18 +3078,10 @@
}
/**
- * 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 @@
}
/**
- * 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 9a0f3ca9..8517b769 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -4911,7 +4911,8 @@
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 @@
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 5a27a0f..e23cd68 100644
--- a/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl
@@ -308,18 +308,36 @@
*/
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 814e06e..8ea226d 100644
--- a/tests/net/java/android/net/util/KeepaliveUtilsTest.kt
+++ b/tests/net/java/android/net/util/KeepaliveUtilsTest.kt
@@ -78,7 +78,6 @@
assertRunWithException(arrayOf("5"))
// Check resource with invalid slots value.
- assertRunWithException(arrayOf("2,2"))
assertRunWithException(arrayOf("3,-1"))
// Check resource with invalid transport type.