Merge "[Notif] Allow locking importance on notification" into pi-dev
diff --git a/Android.bp b/Android.bp
index 9c76e14..22fe23d 100644
--- a/Android.bp
+++ b/Android.bp
@@ -603,6 +603,7 @@
         "core/java/android/content/EventLogTags.logtags",
         "core/java/android/speech/tts/EventLogTags.logtags",
         "core/java/android/net/EventLogTags.logtags",
+        "core/java/android/os/EventLogTags.logtags",
         "core/java/android/webkit/EventLogTags.logtags",
         "core/java/com/android/internal/app/EventLogTags.logtags",
         "core/java/com/android/internal/logging/EventLogTags.logtags",
diff --git a/api/current.txt b/api/current.txt
index dd71724..eac2168 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -7212,7 +7212,6 @@
     method public void writeToParcel(android.os.Parcel, int);
     field public static final android.os.Parcelable.Creator<android.app.slice.Slice> CREATOR;
     field public static final java.lang.String EXTRA_RANGE_VALUE = "android.app.slice.extra.RANGE_VALUE";
-    field public static final deprecated java.lang.String EXTRA_SLIDER_VALUE = "android.app.slice.extra.SLIDER_VALUE";
     field public static final java.lang.String EXTRA_TOGGLE_STATE = "android.app.slice.extra.TOGGLE_STATE";
     field public static final java.lang.String HINT_ACTIONS = "actions";
     field public static final java.lang.String HINT_ERROR = "error";
@@ -7239,14 +7238,12 @@
     field public static final java.lang.String SUBTYPE_MILLIS = "millis";
     field public static final java.lang.String SUBTYPE_PRIORITY = "priority";
     field public static final java.lang.String SUBTYPE_RANGE = "range";
-    field public static final deprecated java.lang.String SUBTYPE_SLIDER = "slider";
     field public static final java.lang.String SUBTYPE_SOURCE = "source";
     field public static final java.lang.String SUBTYPE_TOGGLE = "toggle";
     field public static final java.lang.String SUBTYPE_VALUE = "value";
   }
 
   public static class Slice.Builder {
-    ctor public deprecated Slice.Builder(android.net.Uri);
     ctor public Slice.Builder(android.net.Uri, android.app.slice.SliceSpec);
     ctor public Slice.Builder(android.app.slice.Slice.Builder);
     method public android.app.slice.Slice.Builder addAction(android.app.PendingIntent, android.app.slice.Slice, java.lang.String);
@@ -7258,10 +7255,8 @@
     method public android.app.slice.Slice.Builder addRemoteInput(android.app.RemoteInput, java.lang.String, java.util.List<java.lang.String>);
     method public android.app.slice.Slice.Builder addSubSlice(android.app.slice.Slice, java.lang.String);
     method public android.app.slice.Slice.Builder addText(java.lang.CharSequence, java.lang.String, java.util.List<java.lang.String>);
-    method public deprecated android.app.slice.Slice.Builder addTimestamp(long, java.lang.String, java.util.List<java.lang.String>);
     method public android.app.slice.Slice build();
     method public android.app.slice.Slice.Builder setCallerNeeded(boolean);
-    method public deprecated android.app.slice.Slice.Builder setSpec(android.app.slice.SliceSpec);
   }
 
   public final class SliceItem implements android.os.Parcelable {
@@ -7272,11 +7267,11 @@
     method public java.util.List<java.lang.String> getHints();
     method public android.graphics.drawable.Icon getIcon();
     method public int getInt();
+    method public long getLong();
     method public android.app.RemoteInput getRemoteInput();
     method public android.app.slice.Slice getSlice();
     method public java.lang.String getSubType();
     method public java.lang.CharSequence getText();
-    method public long getTimestamp();
     method public boolean hasHint(java.lang.String);
     method public void writeToParcel(android.os.Parcel, int);
     field public static final android.os.Parcelable.Creator<android.app.slice.SliceItem> CREATOR;
@@ -7288,14 +7283,11 @@
     field public static final java.lang.String FORMAT_REMOTE_INPUT = "input";
     field public static final java.lang.String FORMAT_SLICE = "slice";
     field public static final java.lang.String FORMAT_TEXT = "text";
-    field public static final deprecated java.lang.String FORMAT_TIMESTAMP = "long";
   }
 
   public class SliceManager {
     method public android.app.slice.Slice bindSlice(android.net.Uri, java.util.Set<android.app.slice.SliceSpec>);
-    method public deprecated android.app.slice.Slice bindSlice(android.net.Uri, java.util.List<android.app.slice.SliceSpec>);
     method public android.app.slice.Slice bindSlice(android.content.Intent, java.util.Set<android.app.slice.SliceSpec>);
-    method public deprecated android.app.slice.Slice bindSlice(android.content.Intent, java.util.List<android.app.slice.SliceSpec>);
     method public int checkSlicePermission(android.net.Uri, int, int);
     method public java.util.List<android.net.Uri> getPinnedSlices();
     method public java.util.Set<android.app.slice.SliceSpec> getPinnedSpecs(android.net.Uri);
@@ -7303,7 +7295,6 @@
     method public void grantSlicePermission(java.lang.String, android.net.Uri);
     method public android.net.Uri mapIntentToUri(android.content.Intent);
     method public void pinSlice(android.net.Uri, java.util.Set<android.app.slice.SliceSpec>);
-    method public deprecated void pinSlice(android.net.Uri, java.util.List<android.app.slice.SliceSpec>);
     method public void revokeSlicePermission(java.lang.String, android.net.Uri);
     method public void unpinSlice(android.net.Uri);
     field public static final java.lang.String CATEGORY_SLICE = "android.app.slice.category.SLICE";
@@ -7324,7 +7315,6 @@
     method public final java.lang.String getType(android.net.Uri);
     method public final android.net.Uri insert(android.net.Uri, android.content.ContentValues);
     method public android.app.slice.Slice onBindSlice(android.net.Uri, java.util.Set<android.app.slice.SliceSpec>);
-    method public deprecated android.app.slice.Slice onBindSlice(android.net.Uri, java.util.List<android.app.slice.SliceSpec>);
     method public android.app.PendingIntent onCreatePermissionRequest(android.net.Uri);
     method public java.util.Collection<android.net.Uri> onGetSliceDescendants(android.net.Uri);
     method public android.net.Uri onMapIntentToUri(android.content.Intent);
@@ -11020,7 +11010,7 @@
     field public java.lang.String sharedUserId;
     field public int sharedUserLabel;
     field public deprecated android.content.pm.Signature[] signatures;
-    field public android.content.pm.Signature[][] signingCertificateHistory;
+    field public android.content.pm.SigningInfo signingInfo;
     field public java.lang.String[] splitNames;
     field public int[] splitRevisionCodes;
     field public deprecated int versionCode;
@@ -11648,6 +11638,18 @@
     field public static final android.os.Parcelable.Creator<android.content.pm.Signature> CREATOR;
   }
 
+  public final class SigningInfo implements android.os.Parcelable {
+    ctor public SigningInfo();
+    ctor public SigningInfo(android.content.pm.SigningInfo);
+    method public int describeContents();
+    method public android.content.pm.Signature[] getApkContentsSigners();
+    method public android.content.pm.Signature[] getSigningCertificateHistory();
+    method public boolean hasMultipleSigners();
+    method public boolean hasPastSigningCertificates();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<android.content.pm.SigningInfo> CREATOR;
+  }
+
   public final class VersionedPackage implements android.os.Parcelable {
     ctor public VersionedPackage(java.lang.String, int);
     ctor public VersionedPackage(java.lang.String, long);
@@ -27201,6 +27203,7 @@
     field public static final int NET_CAPABILITY_IMS = 4; // 0x4
     field public static final int NET_CAPABILITY_INTERNET = 12; // 0xc
     field public static final int NET_CAPABILITY_MMS = 0; // 0x0
+    field public static final int NET_CAPABILITY_NOT_CONGESTED = 20; // 0x14
     field public static final int NET_CAPABILITY_NOT_METERED = 11; // 0xb
     field public static final int NET_CAPABILITY_NOT_RESTRICTED = 13; // 0xd
     field public static final int NET_CAPABILITY_NOT_ROAMING = 18; // 0x12
@@ -32052,6 +32055,7 @@
   }
 
   public class BatteryManager {
+    method public long computeChargeTimeRemaining();
     method public int getIntProperty(int);
     method public long getLongProperty(int);
     method public boolean isCharging();
@@ -41681,7 +41685,10 @@
     field public static final java.lang.String KEY_CONFIG_PLANS_PACKAGE_OVERRIDE_STRING = "config_plans_package_override_string";
     field public static final java.lang.String KEY_CONFIG_TELEPHONY_USE_OWN_NUMBER_FOR_VOICEMAIL_BOOL = "config_telephony_use_own_number_for_voicemail_bool";
     field public static final java.lang.String KEY_CSP_ENABLED_BOOL = "csp_enabled_bool";
+    field public static final java.lang.String KEY_DATA_LIMIT_NOTIFICATION_BOOL = "data_limit_notification_bool";
     field public static final java.lang.String KEY_DATA_LIMIT_THRESHOLD_BYTES_LONG = "data_limit_threshold_bytes_long";
+    field public static final java.lang.String KEY_DATA_RAPID_NOTIFICATION_BOOL = "data_rapid_notification_bool";
+    field public static final java.lang.String KEY_DATA_WARNING_NOTIFICATION_BOOL = "data_warning_notification_bool";
     field public static final java.lang.String KEY_DATA_WARNING_THRESHOLD_BYTES_LONG = "data_warning_threshold_bytes_long";
     field public static final java.lang.String KEY_DEFAULT_SIM_CALL_MANAGER_STRING = "default_sim_call_manager_string";
     field public static final java.lang.String KEY_DEFAULT_VM_NUMBER_STRING = "default_vm_number_string";
@@ -42038,7 +42045,6 @@
   }
 
   public class NetworkScan {
-    method public deprecated void stop() throws android.os.RemoteException;
     method public void stopScan();
     field public static final int ERROR_INTERRUPTED = 10002; // 0x2712
     field public static final int ERROR_INVALID_SCAN = 2; // 0x2
@@ -42502,7 +42508,6 @@
     method public boolean isWorldPhone();
     method public void listen(android.telephony.PhoneStateListener, int);
     method public android.telephony.NetworkScan requestNetworkScan(android.telephony.NetworkScanRequest, java.util.concurrent.Executor, android.telephony.TelephonyScanManager.NetworkScanCallback);
-    method public deprecated android.telephony.NetworkScan requestNetworkScan(android.telephony.NetworkScanRequest, android.telephony.TelephonyScanManager.NetworkScanCallback);
     method public void sendDialerSpecialCode(java.lang.String);
     method public java.lang.String sendEnvelopeWithStatus(java.lang.String);
     method public void sendUssdRequest(java.lang.String, android.telephony.TelephonyManager.UssdResponseCallback, android.os.Handler);
@@ -47596,6 +47601,7 @@
     method public void invalidateDrawable(android.graphics.drawable.Drawable);
     method public void invalidateOutline();
     method public boolean isAccessibilityFocused();
+    method public boolean isAccessibilityHeading();
     method public boolean isActivated();
     method public boolean isAttachedToWindow();
     method public boolean isClickable();
@@ -47757,6 +47763,7 @@
     method public void sendAccessibilityEvent(int);
     method public void sendAccessibilityEventUnchecked(android.view.accessibility.AccessibilityEvent);
     method public void setAccessibilityDelegate(android.view.View.AccessibilityDelegate);
+    method public void setAccessibilityHeading(boolean);
     method public void setAccessibilityLiveRegion(int);
     method public void setAccessibilityPaneTitle(java.lang.CharSequence);
     method public void setAccessibilityTraversalAfter(int);
@@ -53832,7 +53839,6 @@
     method public android.graphics.Typeface getTypeface();
     method public android.text.style.URLSpan[] getUrls();
     method public boolean hasSelection();
-    method public boolean isAccessibilityHeading();
     method public boolean isAllCaps();
     method public boolean isCursorVisible();
     method public boolean isElegantTextHeight();
@@ -53855,7 +53861,6 @@
     method protected void onTextChanged(java.lang.CharSequence, int, int, int);
     method public boolean onTextContextMenuItem(int);
     method public void removeTextChangedListener(android.text.TextWatcher);
-    method public void setAccessibilityHeading(boolean);
     method public void setAllCaps(boolean);
     method public final void setAutoLinkMask(int);
     method public void setAutoSizeTextTypeUniformWithConfiguration(int, int, int, int);
diff --git a/api/removed.txt b/api/removed.txt
index 8d72483..833d8ec 100644
--- a/api/removed.txt
+++ b/api/removed.txt
@@ -72,6 +72,36 @@
 
 }
 
+package android.app.slice {
+
+  public final class Slice implements android.os.Parcelable {
+    field public static final deprecated java.lang.String EXTRA_SLIDER_VALUE = "android.app.slice.extra.SLIDER_VALUE";
+    field public static final deprecated java.lang.String SUBTYPE_SLIDER = "slider";
+  }
+
+  public static class Slice.Builder {
+    ctor public deprecated Slice.Builder(android.net.Uri);
+    method public deprecated android.app.slice.Slice.Builder addTimestamp(long, java.lang.String, java.util.List<java.lang.String>);
+    method public deprecated android.app.slice.Slice.Builder setSpec(android.app.slice.SliceSpec);
+  }
+
+  public final class SliceItem implements android.os.Parcelable {
+    method public deprecated long getTimestamp();
+    field public static final deprecated java.lang.String FORMAT_TIMESTAMP = "long";
+  }
+
+  public class SliceManager {
+    method public deprecated android.app.slice.Slice bindSlice(android.net.Uri, java.util.List<android.app.slice.SliceSpec>);
+    method public deprecated android.app.slice.Slice bindSlice(android.content.Intent, java.util.List<android.app.slice.SliceSpec>);
+    method public deprecated void pinSlice(android.net.Uri, java.util.List<android.app.slice.SliceSpec>);
+  }
+
+  public abstract class SliceProvider extends android.content.ContentProvider {
+    method public deprecated android.app.slice.Slice onBindSlice(android.net.Uri, java.util.List<android.app.slice.SliceSpec>);
+  }
+
+}
+
 package android.app.usage {
 
   public final class StorageStats implements android.os.Parcelable {
@@ -511,6 +541,18 @@
 
 }
 
+package android.telephony {
+
+  public class NetworkScan {
+    method public deprecated void stop() throws android.os.RemoteException;
+  }
+
+  public class TelephonyManager {
+    method public deprecated android.telephony.NetworkScan requestNetworkScan(android.telephony.NetworkScanRequest, android.telephony.TelephonyScanManager.NetworkScanCallback);
+  }
+
+}
+
 package android.text.format {
 
   public class DateFormat {
diff --git a/api/system-current.txt b/api/system-current.txt
index d12a2e1..e54d2f6 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -4335,7 +4335,6 @@
     method public byte[] getServerParams();
     method public int getSnapshotVersion();
     method public java.security.cert.CertPath getTrustedHardwareCertPath();
-    method public deprecated byte[] getTrustedHardwarePublicKey();
     method public java.util.List<android.security.keystore.recovery.WrappedApplicationKey> getWrappedApplicationKeys();
     method public void writeToParcel(android.os.Parcel, int);
     field public static final android.os.Parcelable.Creator<android.security.keystore.recovery.KeyChainSnapshot> CREATOR;
@@ -4360,26 +4359,19 @@
 
   public class RecoveryController {
     method public android.security.keystore.recovery.RecoverySession createRecoverySession();
-    method public byte[] generateAndStoreKey(java.lang.String, byte[]) throws android.security.keystore.recovery.InternalRecoveryServiceException, android.security.keystore.recovery.LockScreenRequiredException;
-    method public deprecated java.security.Key generateKey(java.lang.String, byte[]) throws android.security.keystore.recovery.InternalRecoveryServiceException, android.security.keystore.recovery.LockScreenRequiredException;
     method public java.security.Key generateKey(java.lang.String) throws android.security.keystore.recovery.InternalRecoveryServiceException, android.security.keystore.recovery.LockScreenRequiredException;
-    method public deprecated java.util.List<java.lang.String> getAliases(java.lang.String) throws android.security.keystore.recovery.InternalRecoveryServiceException;
     method public java.util.List<java.lang.String> getAliases() throws android.security.keystore.recovery.InternalRecoveryServiceException;
     method public static android.security.keystore.recovery.RecoveryController getInstance(android.content.Context);
     method public java.security.Key getKey(java.lang.String) throws android.security.keystore.recovery.InternalRecoveryServiceException, java.security.UnrecoverableKeyException;
     method public android.security.keystore.recovery.KeyChainSnapshot getKeyChainSnapshot() throws android.security.keystore.recovery.InternalRecoveryServiceException;
-    method public deprecated android.security.keystore.recovery.KeyChainSnapshot getRecoveryData() throws android.security.keystore.recovery.InternalRecoveryServiceException;
     method public int[] getRecoverySecretTypes() throws android.security.keystore.recovery.InternalRecoveryServiceException;
-    method public deprecated int getRecoveryStatus(java.lang.String, java.lang.String) throws android.security.keystore.recovery.InternalRecoveryServiceException;
     method public int getRecoveryStatus(java.lang.String) throws android.security.keystore.recovery.InternalRecoveryServiceException;
     method public java.util.Map<java.lang.String, java.security.cert.X509Certificate> getRootCertificates();
     method public java.security.Key importKey(java.lang.String, byte[]) throws android.security.keystore.recovery.InternalRecoveryServiceException, android.security.keystore.recovery.LockScreenRequiredException;
-    method public deprecated void initRecoveryService(java.lang.String, byte[]) throws java.security.cert.CertificateException, android.security.keystore.recovery.InternalRecoveryServiceException;
     method public void initRecoveryService(java.lang.String, byte[], byte[]) throws java.security.cert.CertificateException, android.security.keystore.recovery.InternalRecoveryServiceException;
     method public static boolean isRecoverableKeyStoreEnabled(android.content.Context);
     method public void removeKey(java.lang.String) throws android.security.keystore.recovery.InternalRecoveryServiceException;
     method public void setRecoverySecretTypes(int[]) throws android.security.keystore.recovery.InternalRecoveryServiceException;
-    method public deprecated void setRecoveryStatus(java.lang.String, java.lang.String, int) throws android.security.keystore.recovery.InternalRecoveryServiceException, android.content.pm.PackageManager.NameNotFoundException;
     method public void setRecoveryStatus(java.lang.String, int) throws android.security.keystore.recovery.InternalRecoveryServiceException;
     method public void setServerParams(byte[]) throws android.security.keystore.recovery.InternalRecoveryServiceException;
     method public void setSnapshotCreatedPendingIntent(android.app.PendingIntent) throws android.security.keystore.recovery.InternalRecoveryServiceException;
@@ -4391,9 +4383,6 @@
   public class RecoverySession implements java.lang.AutoCloseable {
     method public void close();
     method public java.util.Map<java.lang.String, java.security.Key> recoverKeyChainSnapshot(byte[], java.util.List<android.security.keystore.recovery.WrappedApplicationKey>) throws android.security.keystore.recovery.DecryptionFailedException, android.security.keystore.recovery.InternalRecoveryServiceException, android.security.keystore.recovery.SessionExpiredException;
-    method public deprecated java.util.Map<java.lang.String, byte[]> recoverKeys(byte[], java.util.List<android.security.keystore.recovery.WrappedApplicationKey>) throws android.security.keystore.recovery.DecryptionFailedException, android.security.keystore.recovery.InternalRecoveryServiceException, android.security.keystore.recovery.SessionExpiredException;
-    method public deprecated byte[] start(byte[], byte[], byte[], java.util.List<android.security.keystore.recovery.KeyChainProtectionParams>) throws java.security.cert.CertificateException, android.security.keystore.recovery.InternalRecoveryServiceException;
-    method public deprecated byte[] start(java.security.cert.CertPath, byte[], byte[], java.util.List<android.security.keystore.recovery.KeyChainProtectionParams>) throws java.security.cert.CertificateException, android.security.keystore.recovery.InternalRecoveryServiceException;
     method public byte[] start(java.lang.String, java.security.cert.CertPath, byte[], byte[], java.util.List<android.security.keystore.recovery.KeyChainProtectionParams>) throws java.security.cert.CertificateException, android.security.keystore.recovery.InternalRecoveryServiceException;
   }
 
@@ -4403,7 +4392,6 @@
 
   public final class WrappedApplicationKey implements android.os.Parcelable {
     method public int describeContents();
-    method public deprecated byte[] getAccount();
     method public java.lang.String getAlias();
     method public byte[] getEncryptedKeyMaterial();
     method public void writeToParcel(android.os.Parcel, int);
@@ -4413,7 +4401,6 @@
   public static class WrappedApplicationKey.Builder {
     ctor public WrappedApplicationKey.Builder();
     method public android.security.keystore.recovery.WrappedApplicationKey build();
-    method public deprecated android.security.keystore.recovery.WrappedApplicationKey.Builder setAccount(byte[]);
     method public android.security.keystore.recovery.WrappedApplicationKey.Builder setAlias(java.lang.String);
     method public android.security.keystore.recovery.WrappedApplicationKey.Builder setEncryptedKeyMaterial(byte[]);
   }
@@ -5053,11 +5040,6 @@
 
 package android.telephony {
 
-  public static final class AccessNetworkConstants.TransportType {
-    field public static final int WLAN = 2; // 0x2
-    field public static final int WWAN = 1; // 0x1
-  }
-
   public class CarrierConfigManager {
     method public static android.os.PersistableBundle getDefaultConfig();
     method public void updateConfigForPhoneId(int, java.lang.String);
@@ -5072,66 +5054,6 @@
     field public static final java.lang.String MBMS_STREAMING_SERVICE_ACTION = "android.telephony.action.EmbmsStreaming";
   }
 
-  public class NetworkRegistrationState implements android.os.Parcelable {
-    ctor public NetworkRegistrationState(int, int, int, int, int, boolean, int[], android.telephony.CellIdentity);
-    ctor protected NetworkRegistrationState(android.os.Parcel);
-    method public int describeContents();
-    method public int getAccessNetworkTechnology();
-    method public int[] getAvailableServices();
-    method public android.telephony.CellIdentity getCellIdentity();
-    method public int getDomain();
-    method public int getReasonForDenial();
-    method public int getRegState();
-    method public int getTransportType();
-    method public boolean isEmergencyEnabled();
-    method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.NetworkRegistrationState> CREATOR;
-    field public static final int DOMAIN_CS = 1; // 0x1
-    field public static final int DOMAIN_PS = 2; // 0x2
-    field public static final int REG_STATE_DENIED = 3; // 0x3
-    field public static final int REG_STATE_HOME = 1; // 0x1
-    field public static final int REG_STATE_NOT_REG_NOT_SEARCHING = 0; // 0x0
-    field public static final int REG_STATE_NOT_REG_SEARCHING = 2; // 0x2
-    field public static final int REG_STATE_ROAMING = 5; // 0x5
-    field public static final int REG_STATE_UNKNOWN = 4; // 0x4
-    field public static final int SERVICE_TYPE_DATA = 2; // 0x2
-    field public static final int SERVICE_TYPE_EMERGENCY = 5; // 0x5
-    field public static final int SERVICE_TYPE_SMS = 3; // 0x3
-    field public static final int SERVICE_TYPE_VIDEO = 4; // 0x4
-    field public static final int SERVICE_TYPE_VOICE = 1; // 0x1
-  }
-
-  public abstract class NetworkService extends android.app.Service {
-    ctor public NetworkService();
-    method protected abstract android.telephony.NetworkService.NetworkServiceProvider createNetworkServiceProvider(int);
-    field public static final java.lang.String NETWORK_SERVICE_EXTRA_SLOT_ID = "android.telephony.extra.SLOT_ID";
-    field public static final java.lang.String NETWORK_SERVICE_INTERFACE = "android.telephony.NetworkService";
-  }
-
-  public class NetworkService.NetworkServiceProvider {
-    ctor public NetworkService.NetworkServiceProvider(int);
-    method public void getNetworkRegistrationState(int, android.telephony.NetworkServiceCallback);
-    method public final int getSlotId();
-    method public final void notifyNetworkRegistrationStateChanged();
-    method protected void onDestroy();
-  }
-
-  public class NetworkServiceCallback {
-    method public void onGetNetworkRegistrationStateComplete(int, android.telephony.NetworkRegistrationState);
-    field public static final int RESULT_ERROR_BUSY = 3; // 0x3
-    field public static final int RESULT_ERROR_FAILED = 5; // 0x5
-    field public static final int RESULT_ERROR_ILLEGAL_STATE = 4; // 0x4
-    field public static final int RESULT_ERROR_INVALID_ARG = 2; // 0x2
-    field public static final int RESULT_ERROR_UNSUPPORTED = 1; // 0x1
-    field public static final int RESULT_SUCCESS = 0; // 0x0
-  }
-
-  public class ServiceState implements android.os.Parcelable {
-    method public java.util.List<android.telephony.NetworkRegistrationState> getNetworkRegistrationStates();
-    method public java.util.List<android.telephony.NetworkRegistrationState> getNetworkRegistrationStates(int);
-    method public android.telephony.NetworkRegistrationState getNetworkRegistrationStates(int, int);
-  }
-
   public final class SmsManager {
     method public void sendMultipartTextMessageWithoutPersisting(java.lang.String, java.lang.String, java.util.List<java.lang.String>, java.util.List<android.app.PendingIntent>, java.util.List<android.app.PendingIntent>);
     method public void sendTextMessageWithoutPersisting(java.lang.String, java.lang.String, java.lang.String, android.app.PendingIntent, android.app.PendingIntent);
@@ -5334,94 +5256,6 @@
 
 }
 
-package android.telephony.data {
-
-  public final class DataCallResponse implements android.os.Parcelable {
-    ctor public DataCallResponse(int, int, int, int, java.lang.String, java.lang.String, java.util.List<android.net.LinkAddress>, java.util.List<java.net.InetAddress>, java.util.List<java.net.InetAddress>, java.util.List<java.lang.String>, int);
-    ctor public DataCallResponse(android.os.Parcel);
-    method public int describeContents();
-    method public int getActive();
-    method public java.util.List<android.net.LinkAddress> getAddresses();
-    method public int getCallId();
-    method public java.util.List<java.net.InetAddress> getDnses();
-    method public java.util.List<java.net.InetAddress> getGateways();
-    method public java.lang.String getIfname();
-    method public int getMtu();
-    method public java.util.List<java.lang.String> getPcscfs();
-    method public int getStatus();
-    method public int getSuggestedRetryTime();
-    method public java.lang.String getType();
-    method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.data.DataCallResponse> CREATOR;
-  }
-
-  public final class DataProfile implements android.os.Parcelable {
-    ctor public DataProfile(int, java.lang.String, java.lang.String, int, java.lang.String, java.lang.String, int, int, int, int, boolean, int, java.lang.String, int, int, java.lang.String, java.lang.String, boolean);
-    ctor public DataProfile(android.os.Parcel);
-    method public int describeContents();
-    method public java.lang.String getApn();
-    method public int getAuthType();
-    method public int getBearerBitmap();
-    method public int getMaxConns();
-    method public int getMaxConnsTime();
-    method public int getMtu();
-    method public java.lang.String getMvnoMatchData();
-    method public java.lang.String getMvnoType();
-    method public java.lang.String getPassword();
-    method public int getProfileId();
-    method public java.lang.String getProtocol();
-    method public java.lang.String getRoamingProtocol();
-    method public int getSupportedApnTypesBitmap();
-    method public int getType();
-    method public java.lang.String getUserName();
-    method public int getWaitTime();
-    method public boolean isEnabled();
-    method public boolean isModemCognitive();
-    method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.data.DataProfile> CREATOR;
-    field public static final int TYPE_3GPP = 1; // 0x1
-    field public static final int TYPE_3GPP2 = 2; // 0x2
-    field public static final int TYPE_COMMON = 0; // 0x0
-  }
-
-  public abstract class DataService extends android.app.Service {
-    ctor public DataService();
-    method public abstract android.telephony.data.DataService.DataServiceProvider createDataServiceProvider(int);
-    field public static final java.lang.String DATA_SERVICE_EXTRA_SLOT_ID = "android.telephony.data.extra.SLOT_ID";
-    field public static final java.lang.String DATA_SERVICE_INTERFACE = "android.telephony.data.DataService";
-    field public static final int REQUEST_REASON_HANDOVER = 3; // 0x3
-    field public static final int REQUEST_REASON_NORMAL = 1; // 0x1
-    field public static final int REQUEST_REASON_SHUTDOWN = 2; // 0x2
-  }
-
-  public class DataService.DataServiceProvider {
-    ctor public DataService.DataServiceProvider(int);
-    method public void deactivateDataCall(int, int, android.telephony.data.DataServiceCallback);
-    method public void getDataCallList(android.telephony.data.DataServiceCallback);
-    method public final int getSlotId();
-    method public final void notifyDataCallListChanged(java.util.List<android.telephony.data.DataCallResponse>);
-    method protected void onDestroy();
-    method public void setDataProfile(java.util.List<android.telephony.data.DataProfile>, boolean, android.telephony.data.DataServiceCallback);
-    method public void setInitialAttachApn(android.telephony.data.DataProfile, boolean, android.telephony.data.DataServiceCallback);
-    method public void setupDataCall(int, android.telephony.data.DataProfile, boolean, boolean, int, android.net.LinkProperties, android.telephony.data.DataServiceCallback);
-  }
-
-  public class DataServiceCallback {
-    method public void onDataCallListChanged(java.util.List<android.telephony.data.DataCallResponse>);
-    method public void onDeactivateDataCallComplete(int);
-    method public void onGetDataCallListComplete(int, java.util.List<android.telephony.data.DataCallResponse>);
-    method public void onSetDataProfileComplete(int);
-    method public void onSetInitialAttachApnComplete(int);
-    method public void onSetupDataCallComplete(int, android.telephony.data.DataCallResponse);
-    field public static final int RESULT_ERROR_BUSY = 3; // 0x3
-    field public static final int RESULT_ERROR_ILLEGAL_STATE = 4; // 0x4
-    field public static final int RESULT_ERROR_INVALID_ARG = 2; // 0x2
-    field public static final int RESULT_ERROR_UNSUPPORTED = 1; // 0x1
-    field public static final int RESULT_SUCCESS = 0; // 0x0
-  }
-
-}
-
 package android.telephony.euicc {
 
   public final class DownloadableSubscription implements android.os.Parcelable {
diff --git a/api/system-removed.txt b/api/system-removed.txt
index 48f43e0..961026b 100644
--- a/api/system-removed.txt
+++ b/api/system-removed.txt
@@ -91,6 +91,38 @@
 
 }
 
+package android.security.keystore.recovery {
+
+  public final class KeyChainSnapshot implements android.os.Parcelable {
+    method public deprecated byte[] getTrustedHardwarePublicKey();
+  }
+
+  public class RecoveryController {
+    method public deprecated byte[] generateAndStoreKey(java.lang.String, byte[]) throws android.security.keystore.recovery.InternalRecoveryServiceException, android.security.keystore.recovery.LockScreenRequiredException;
+    method public deprecated java.security.Key generateKey(java.lang.String, byte[]) throws android.security.keystore.recovery.InternalRecoveryServiceException, android.security.keystore.recovery.LockScreenRequiredException;
+    method public deprecated java.util.List<java.lang.String> getAliases(java.lang.String) throws android.security.keystore.recovery.InternalRecoveryServiceException;
+    method public deprecated android.security.keystore.recovery.KeyChainSnapshot getRecoveryData() throws android.security.keystore.recovery.InternalRecoveryServiceException;
+    method public deprecated int getRecoveryStatus(java.lang.String, java.lang.String) throws android.security.keystore.recovery.InternalRecoveryServiceException;
+    method public deprecated void initRecoveryService(java.lang.String, byte[]) throws java.security.cert.CertificateException, android.security.keystore.recovery.InternalRecoveryServiceException;
+    method public deprecated void setRecoveryStatus(java.lang.String, java.lang.String, int) throws android.security.keystore.recovery.InternalRecoveryServiceException, android.content.pm.PackageManager.NameNotFoundException;
+  }
+
+  public class RecoverySession implements java.lang.AutoCloseable {
+    method public deprecated java.util.Map<java.lang.String, byte[]> recoverKeys(byte[], java.util.List<android.security.keystore.recovery.WrappedApplicationKey>) throws android.security.keystore.recovery.DecryptionFailedException, android.security.keystore.recovery.InternalRecoveryServiceException, android.security.keystore.recovery.SessionExpiredException;
+    method public deprecated byte[] start(byte[], byte[], byte[], java.util.List<android.security.keystore.recovery.KeyChainProtectionParams>) throws java.security.cert.CertificateException, android.security.keystore.recovery.InternalRecoveryServiceException;
+    method public deprecated byte[] start(java.security.cert.CertPath, byte[], byte[], java.util.List<android.security.keystore.recovery.KeyChainProtectionParams>) throws java.security.cert.CertificateException, android.security.keystore.recovery.InternalRecoveryServiceException;
+  }
+
+  public final class WrappedApplicationKey implements android.os.Parcelable {
+    method public deprecated byte[] getAccount();
+  }
+
+  public static class WrappedApplicationKey.Builder {
+    method public deprecated android.security.keystore.recovery.WrappedApplicationKey.Builder setAccount(byte[]);
+  }
+
+}
+
 package android.service.notification {
 
   public abstract class NotificationListenerService extends android.app.Service {
diff --git a/api/test-current.txt b/api/test-current.txt
index b62607b..ea8e5db 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -917,6 +917,10 @@
 
 package android.telephony.mbms {
 
+  public static class DownloadRequest.Builder {
+    method public android.telephony.mbms.DownloadRequest.Builder setServiceId(java.lang.String);
+  }
+
   public final class FileInfo implements android.os.Parcelable {
     ctor public FileInfo(android.net.Uri, java.lang.String);
   }
diff --git a/config/hiddenapi-light-greylist.txt b/config/hiddenapi-light-greylist.txt
index acd4425..81c9b6b 100644
--- a/config/hiddenapi-light-greylist.txt
+++ b/config/hiddenapi-light-greylist.txt
@@ -2,19 +2,8 @@
 Landroid/accounts/IAccountAuthenticatorResponse$Stub;-><init>()V
 Landroid/accounts/IAccountManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/accounts/IAccountManager;
 Landroid/accounts/IAccountManager$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
-Landroid/animation/KeyframeSet;-><init>([Landroid/animation/Keyframe;)V
-Landroid/animation/KeyframeSet;->ofFloat([F)Landroid/animation/KeyframeSet;
-Landroid/animation/KeyframeSet;->ofInt([I)Landroid/animation/KeyframeSet;
-Landroid/animation/KeyframeSet;->ofKeyframe([Landroid/animation/Keyframe;)Landroid/animation/KeyframeSet;
-Landroid/animation/KeyframeSet;->ofObject([Ljava/lang/Object;)Landroid/animation/KeyframeSet;
 Landroid/animation/LayoutTransition;->cancel(I)V
 Landroid/animation/LayoutTransition;->cancel()V
-Landroid/animation/PropertyValuesHolder$FloatPropertyValuesHolder;-><init>(Landroid/util/Property;[F)V
-Landroid/animation/PropertyValuesHolder$FloatPropertyValuesHolder;-><init>(Ljava/lang/String;[F)V
-Landroid/animation/PropertyValuesHolder$IntPropertyValuesHolder;-><init>(Landroid/util/Property;[I)V
-Landroid/animation/PropertyValuesHolder$IntPropertyValuesHolder;-><init>(Ljava/lang/String;[I)V
-Landroid/animation/PropertyValuesHolder$MultiFloatValuesHolder;-><init>(Ljava/lang/String;Landroid/animation/TypeConverter;Landroid/animation/TypeEvaluator;[Ljava/lang/Object;)V
-Landroid/animation/PropertyValuesHolder$MultiIntValuesHolder;-><init>(Ljava/lang/String;Landroid/animation/TypeConverter;Landroid/animation/TypeEvaluator;[Ljava/lang/Object;)V
 Landroid/animation/ValueAnimator;->animateValue(F)V
 Landroid/animation/ValueAnimator;->sDurationScale:F
 Landroid/app/Activity;->getActivityOptions()Landroid/app/ActivityOptions;
@@ -62,7 +51,6 @@
 Landroid/app/Activity;->mWindow:Landroid/view/Window;
 Landroid/app/Activity;->mWindowManager:Landroid/view/WindowManager;
 Landroid/app/ActivityOptions;->makeMultiThumbFutureAspectScaleAnimation(Landroid/content/Context;Landroid/os/Handler;Landroid/view/IAppTransitionAnimationSpecsFuture;Landroid/app/ActivityOptions$OnAnimationStartedListener;Z)Landroid/app/ActivityOptions;
-Landroid/app/ActivityOptions;->startSharedElementAnimation(Landroid/view/Window;[Landroid/util/Pair;)Landroid/app/ActivityOptions;
 Landroid/app/Activity;->setDisablePreviewScreenshots(Z)V
 Landroid/app/Activity;->setPersistent(Z)V
 Landroid/app/ActivityThread$ActivityClientRecord;->activityInfo:Landroid/content/pm/ActivityInfo;
@@ -136,7 +124,6 @@
 Landroid/app/ActivityThread;->mServices:Landroid/util/ArrayMap;
 Landroid/app/ActivityThread;->performNewIntents(Landroid/os/IBinder;Ljava/util/List;Z)V
 Landroid/app/ActivityThread;->performStopActivity(Landroid/os/IBinder;ZLjava/lang/String;)V
-Landroid/app/ActivityThread;->printRow(Ljava/io/PrintWriter;Ljava/lang/String;[Ljava/lang/Object;)V
 Landroid/app/ActivityThread$ProviderClientRecord;->mHolder:Landroid/app/ContentProviderHolder;
 Landroid/app/ActivityThread$ProviderClientRecord;->mLocalProvider:Landroid/content/ContentProvider;
 Landroid/app/ActivityThread$ProviderClientRecord;->mProvider:Landroid/content/IContentProvider;
@@ -159,7 +146,6 @@
 Landroid/app/admin/IDevicePolicyManager$Stub;->TRANSACTION_packageHasActiveAdmins:I
 Landroid/app/admin/IDevicePolicyManager$Stub;->TRANSACTION_removeActiveAdmin:I
 Landroid/app/admin/SecurityLog$SecurityEvent;-><init>([B)V
-Landroid/app/admin/SecurityLog;->writeEvent(I[Ljava/lang/Object;)I
 Landroid/app/AlarmManager;->FLAG_ALLOW_WHILE_IDLE_UNRESTRICTED:I
 Landroid/app/AlarmManager;->FLAG_IDLE_UNTIL:I
 Landroid/app/AlarmManager;->FLAG_STANDALONE:I
@@ -218,7 +204,6 @@
 Landroid/app/AppOpsManager;->OP_WRITE_SMS:I
 Landroid/app/AppOpsManager;->permissionToOpCode(Ljava/lang/String;)I
 Landroid/app/AppOpsManager;->strOpToOp(Ljava/lang/String;)I
-Landroid/app/backup/AbsoluteFileBackupHelper;-><init>(Landroid/content/Context;[Ljava/lang/String;)V
 Landroid/app/backup/BackupDataInput$EntityHeader;->dataSize:I
 Landroid/app/backup/BackupDataInput$EntityHeader;->key:Ljava/lang/String;
 Landroid/app/backup/BackupDataInputStream;->dataSize:I
@@ -226,7 +211,6 @@
 Landroid/app/backup/BackupDataOutput;->mBackupWriter:J
 Landroid/app/backup/BackupHelperDispatcher$Header;->chunkSize:I
 Landroid/app/backup/BackupHelperDispatcher$Header;->keyPrefix:Ljava/lang/String;
-Landroid/app/backup/BlobBackupHelper;-><init>(I[Ljava/lang/String;)V
 Landroid/app/backup/FileBackupHelperBase;->writeNewStateDescription(Landroid/os/ParcelFileDescriptor;)V
 Landroid/app/backup/FullBackup;->backupToTar(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Landroid/app/backup/FullBackupDataOutput;)I
 Landroid/app/backup/FullBackupDataOutput;->addSize(J)V
@@ -263,10 +247,7 @@
 Landroid/app/Dialog;->mListenersHandler:Landroid/os/Handler;
 Landroid/app/Dialog;->mOwnerActivity:Landroid/app/Activity;
 Landroid/app/Dialog;->mShowMessage:Landroid/os/Message;
-Landroid/app/DownloadManager;->forceDownload([J)V
-Landroid/app/DownloadManager;->markRowDeleted([J)I
 Landroid/app/DownloadManager$Request;->mUri:Landroid/net/Uri;
-Landroid/app/DownloadManager;->restartDownload([J)V
 Landroid/app/FragmentManagerImpl;->mAdded:Ljava/util/ArrayList;
 Landroid/app/FragmentManagerImpl;->noteStateNotSaved()V
 Landroid/app/Fragment;->mChildFragmentManager:Landroid/app/FragmentManagerImpl;
@@ -463,7 +444,6 @@
 Landroid/bluetooth/IBluetooth$Stub;->asInterface(Landroid/os/IBinder;)Landroid/bluetooth/IBluetooth;
 Landroid/bluetooth/IBluetooth$Stub$Proxy;->getAddress()Ljava/lang/String;
 Landroid/bluetooth/le/ScanRecord;->parseFromBytes([B)Landroid/bluetooth/le/ScanRecord;
-Landroid/content/AsyncTaskLoader$LoadTask;->doInBackground([Ljava/lang/Void;)Ljava/lang/Object;
 Landroid/content/AsyncTaskLoader;->mExecutor:Ljava/util/concurrent/Executor;
 Landroid/content/BroadcastReceiver$PendingResult;-><init>(ILjava/lang/String;Landroid/os/Bundle;IZZLandroid/os/IBinder;II)V
 Landroid/content/BroadcastReceiver;->setPendingResult(Landroid/content/BroadcastReceiver$PendingResult;)V
@@ -711,7 +691,6 @@
 Landroid/database/AbstractCursor;->mNotifyUri:Landroid/net/Uri;
 Landroid/database/AbstractCursor;->mRowIdColumnIndex:I
 Landroid/database/AbstractWindowedCursor;->clearOrCreateWindow(Ljava/lang/String;)V
-Landroid/database/CursorJoiner;->compareStrings([Ljava/lang/String;)I
 Landroid/database/CursorWindow;->mWindowPtr:J
 Landroid/database/CursorWindow;->sCursorWindowSize:I
 Landroid/database/CursorWindow;->sWindowToPidMap:Landroid/util/LongSparseArray;
@@ -730,14 +709,6 @@
 Landroid/database/sqlite/SQLiteOpenHelper;->mName:Ljava/lang/String;
 Landroid/database/sqlite/SQLiteStatement;-><init>(Landroid/database/sqlite/SQLiteDatabase;Ljava/lang/String;[Ljava/lang/Object;)V
 Landroid/ddm/DdmHandleAppName;->getAppName()Ljava/lang/String;
-Landroid/filterfw/core/AsyncRunner$AsyncRunnerTask;->doInBackground([Landroid/filterfw/core/SyncRunner;)Landroid/filterfw/core/AsyncRunner$RunnerResult;
-Landroid/filterfw/core/FilterFunction;->executeWithArgList([Ljava/lang/Object;)Landroid/filterfw/core/Frame;
-Landroid/filterfw/core/Filter;->initWithAssignmentList([Ljava/lang/Object;)V
-Landroid/filterfw/core/KeyValueMap;->fromKeyValues([Ljava/lang/Object;)Landroid/filterfw/core/KeyValueMap;
-Landroid/filterfw/core/KeyValueMap;->setKeyValues([Ljava/lang/Object;)V
-Landroid/filterfw/FilterFunctionEnvironment;->createFunction(Ljava/lang/Class;[Ljava/lang/Object;)Landroid/filterfw/core/FilterFunction;
-Landroid/filterfw/GraphEnvironment;->addReferences([Ljava/lang/Object;)V
-Landroid/filterfw/io/GraphReader;->addReferencesByKeysAndValues([Ljava/lang/Object;)V
 Landroid/graphics/AvoidXfermode$Mode;->AVOID:Landroid/graphics/AvoidXfermode$Mode;
 Landroid/graphics/AvoidXfermode$Mode;->TARGET:Landroid/graphics/AvoidXfermode$Mode;
 Landroid/graphics/BaseCanvas;->mNativeCanvasWrapper:J
@@ -919,11 +890,7 @@
 Landroid/hardware/camera2/CaptureResult;->TONEMAP_CURVE_BLUE:Landroid/hardware/camera2/CaptureResult$Key;
 Landroid/hardware/camera2/CaptureResult;->TONEMAP_CURVE_GREEN:Landroid/hardware/camera2/CaptureResult$Key;
 Landroid/hardware/camera2/CaptureResult;->TONEMAP_CURVE_RED:Landroid/hardware/camera2/CaptureResult$Key;
-Landroid/hardware/camera2/impl/CameraMetadataNative;->areValuesAllNull([Ljava/lang/Object;)Z
 Landroid/hardware/camera2/impl/CameraMetadataNative;->mMetadataPtr:J
-Landroid/hardware/camera2/utils/HashCodeHelpers;->hashCode([F)I
-Landroid/hardware/camera2/utils/HashCodeHelpers;->hashCodeGeneric([Ljava/lang/Object;)I
-Landroid/hardware/camera2/utils/HashCodeHelpers;->hashCode([I)I
 Landroid/hardware/Camera;->addCallbackBuffer([BI)V
 Landroid/hardware/Camera;->mNativeContext:J
 Landroid/hardware/Camera;->openLegacy(II)Landroid/hardware/Camera;
@@ -990,25 +957,15 @@
 Landroid/hardware/usb/UsbRequest;->mLength:I
 Landroid/hardware/usb/UsbRequest;->mNativeContext:J
 Landroid/icu/impl/CurrencyData;-><init>()V
-Landroid/icu/impl/locale/XLocaleDistance$RegionMapper$Builder;->addParadigms([Ljava/lang/String;)Landroid/icu/impl/locale/XLocaleDistance$RegionMapper$Builder;
-Landroid/icu/impl/TimeZoneGenericNames;->formatPattern(Landroid/icu/impl/TimeZoneGenericNames$Pattern;[Ljava/lang/String;)Ljava/lang/String;
-Landroid/icu/impl/TimeZoneGenericNames$GenericNameType;-><init>([Ljava/lang/String;)V
 Landroid/icu/text/ArabicShaping;->isAlefMaksouraChar(C)Z
 Landroid/icu/text/ArabicShaping;->isSeenTailFamilyChar(C)I
 Landroid/icu/text/ArabicShaping;->isTailChar(C)Z
 Landroid/icu/text/ArabicShaping;->isYehHamzaChar(C)Z
-Landroid/icu/text/Collator;->getIntValue(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)I
 Landroid/icu/text/DateFormatSymbols;->getLocale(Landroid/icu/util/ULocale$Type;)Landroid/icu/util/ULocale;
 Landroid/icu/text/DateIntervalFormat;-><init>()V
 Landroid/icu/text/DateTimePatternGenerator$DistanceInfo;-><init>()V
 Landroid/icu/text/DecimalFormatSymbols;->getLocale(Landroid/icu/util/ULocale$Type;)Landroid/icu/util/ULocale;
-Landroid/icu/text/DictionaryBreakEngine;-><init>([Ljava/lang/Integer;)V
-Landroid/icu/text/LocaleDisplayNames$LastResortLocaleDisplayNames;-><init>(Landroid/icu/util/ULocale;[Landroid/icu/text/DisplayContext;)V
-Landroid/icu/text/MeasureFormat;->formatMeasuresSlowTrack(Landroid/icu/text/ListFormatter;Ljava/lang/StringBuilder;Ljava/text/FieldPosition;[Landroid/icu/util/Measure;)Ljava/lang/StringBuilder;
 Landroid/icu/text/RuleBasedCollator;->getLocale(Landroid/icu/util/ULocale$Type;)Landroid/icu/util/ULocale;
-Landroid/icu/text/SimpleFormatter;->formatAndAppend(Ljava/lang/StringBuilder;[I[Ljava/lang/CharSequence;)Ljava/lang/StringBuilder;
-Landroid/icu/text/SimpleFormatter;->formatAndReplace(Ljava/lang/StringBuilder;[I[Ljava/lang/CharSequence;)Ljava/lang/StringBuilder;
-Landroid/icu/text/SimpleFormatter;->format([Ljava/lang/CharSequence;)Ljava/lang/String;
 Landroid/icu/text/SpoofChecker$ScriptSet;->and(I)V
 Landroid/icu/text/SpoofChecker$ScriptSet;-><init>()V
 Landroid/icu/text/SpoofChecker$ScriptSet;->isFull()Z
@@ -1018,11 +975,6 @@
 Landroid/icu/text/Transliterator;->transliterate(Ljava/lang/String;)Ljava/lang/String;
 Landroid/icu/text/UFormat;->getLocale(Landroid/icu/util/ULocale$Type;)Landroid/icu/util/ULocale;
 Landroid/icu/util/Calendar;->getLocale(Landroid/icu/util/ULocale$Type;)Landroid/icu/util/ULocale;
-Landroid/icu/util/Currency$EquivalenceRelation;->add([Ljava/lang/Object;)Landroid/icu/util/Currency$EquivalenceRelation;
-Landroid/icu/util/GenderInfo;->getListGender([Landroid/icu/util/GenderInfo$Gender;)Landroid/icu/util/GenderInfo$Gender;
-Landroid/icu/util/LocaleMatcher;->getBestMatch([Landroid/icu/util/ULocale;)Landroid/icu/util/ULocale;
-Landroid/icu/util/LocalePriorityList;->add([Landroid/icu/util/ULocale;)Landroid/icu/util/LocalePriorityList$Builder;
-Landroid/icu/util/LocalePriorityList$Builder;->add([Landroid/icu/util/ULocale;)Landroid/icu/util/LocalePriorityList$Builder;
 Landroid/inputmethodservice/InputMethodService;->mExtractEditText:Landroid/inputmethodservice/ExtractEditText;
 Landroid/inputmethodservice/InputMethodService;->mRootView:Landroid/view/View;
 Landroid/inputmethodservice/InputMethodService;->mSettingsObserver:Landroid/inputmethodservice/InputMethodService$SettingsObserver;
@@ -1049,7 +1001,6 @@
 Landroid/media/AudioFormat;->mEncoding:I
 Landroid/media/AudioFormat;->mSampleRate:I
 Landroid/media/audiofx/AudioEffect;->command(I[B[B)I
-Landroid/media/audiofx/AudioEffect;->concatArrays([[B)[B
 Landroid/media/audiofx/AudioEffect;->getParameter([I[B)I
 Landroid/media/audiofx/AudioEffect;->getParameter([I[I)I
 Landroid/media/audiofx/AudioEffect;-><init>(Ljava/util/UUID;Ljava/util/UUID;II)V
@@ -1125,8 +1076,6 @@
 Landroid/media/AudioTrack;->mStreamType:I
 Landroid/media/AudioTrack;->native_release()V
 Landroid/media/AudioTrack;->postEventFromNative(Ljava/lang/Object;IIILjava/lang/Object;)V
-Landroid/media/effect/SingleFilterEffect;-><init>(Landroid/media/effect/EffectContext;Ljava/lang/String;Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V
-Landroid/media/effect/SizeChangeEffect;-><init>(Landroid/media/effect/EffectContext;Ljava/lang/String;Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V
 Landroid/media/ExifInterface;->getDateTime()J
 Landroid/media/IAudioService;->getStreamMaxVolume(I)I
 Landroid/media/IAudioService;->getStreamVolume(I)I
@@ -1211,7 +1160,6 @@
 Landroid/media/SubtitleTrack$RenderingWidget;->setSize(II)V
 Landroid/media/ThumbnailUtils;->createImageThumbnail(Ljava/lang/String;I)Landroid/graphics/Bitmap;
 Landroid/media/ToneGenerator;->mNativeContext:J
-Landroid/media/tv/TvInputService$OverlayViewCleanUpTask;->doInBackground([Landroid/view/View;)Ljava/lang/Void;
 Landroid/media/VolumeShaper$Configuration;-><init>(IIIDI[F[F)V
 Landroid/media/VolumeShaper$Configuration;->mDurationMs:D
 Landroid/media/VolumeShaper$Configuration;->mId:I
@@ -1265,7 +1213,6 @@
 Landroid/net/LinkProperties;->setHttpProxy(Landroid/net/ProxyInfo;)V
 Landroid/net/LocalSocketImpl;->inboundFileDescriptors:[Ljava/io/FileDescriptor;
 Landroid/net/LocalSocketImpl;->outboundFileDescriptors:[Ljava/io/FileDescriptor;
-Landroid/net/MacAddress;->addr([I)[B
 Landroid/net/NetworkCapabilities;->getCapabilities()[I
 Landroid/net/NetworkCapabilities;->getTransportTypes()[I
 Landroid/net/NetworkPolicyManager;->mService:Landroid/net/INetworkPolicyManager;
@@ -1310,7 +1257,6 @@
 Landroid/net/SSLCertificateSocketFactory;->setChannelIdPrivateKey(Ljava/security/PrivateKey;)V
 Landroid/net/SSLCertificateSocketFactory;->setSoWriteTimeout(Ljava/net/Socket;I)V
 Landroid/net/SSLCertificateSocketFactory;->TAG:Ljava/lang/String;
-Landroid/net/SSLCertificateSocketFactory;->toLengthPrefixedList([[B)[B
 Landroid/net/SSLCertificateSocketFactory;->verifyHostname(Ljava/net/Socket;Ljava/lang/String;)V
 Landroid/net/SSLSessionCache;->mSessionCache:Lcom/android/org/conscrypt/SSLClientSessionCache;
 Landroid/net/StaticIpConfiguration;->gateway:Ljava/net/InetAddress;
@@ -1382,12 +1328,10 @@
 Landroid/net/wifi/WifiSsid;->NONE:Ljava/lang/String;
 Landroid/nfc/NfcAdapter;->getDefaultAdapter()Landroid/nfc/NfcAdapter;
 Landroid/nfc/NfcAdapter;->setNdefPushMessageCallback(Landroid/nfc/NfcAdapter$CreateNdefMessageCallback;Landroid/app/Activity;I)V
-Landroid/nfc/TechListParcel;-><init>([[Ljava/lang/String;)V
 Landroid/opengl/GLSurfaceView$EglHelper;->mEglContext:Ljavax/microedition/khronos/egl/EGLContext;
 Landroid/opengl/GLSurfaceView$GLThread;->mEglHelper:Landroid/opengl/GLSurfaceView$EglHelper;
 Landroid/opengl/GLSurfaceView;->mGLThread:Landroid/opengl/GLSurfaceView$GLThread;
 Landroid/opengl/GLSurfaceView;->mRenderer:Landroid/opengl/GLSurfaceView$Renderer;
-Landroid/os/AsyncTask$AsyncTaskResult;-><init>(Landroid/os/AsyncTask;[Ljava/lang/Object;)V
 Landroid/os/AsyncTask;->mFuture:Ljava/util/concurrent/FutureTask;
 Landroid/os/AsyncTask;->mStatus:Landroid/os/AsyncTask$Status;
 Landroid/os/AsyncTask;->mTaskInvoked:Ljava/util/concurrent/atomic/AtomicBoolean;
@@ -1395,7 +1339,6 @@
 Landroid/os/AsyncTask;->sDefaultExecutor:Ljava/util/concurrent/Executor;
 Landroid/os/AsyncTask;->setDefaultExecutor(Ljava/util/concurrent/Executor;)V
 Landroid/os/BatteryStats$Counter;->getCountLocked(I)I
-Landroid/os/BatteryStats;->dumpLine(Ljava/io/PrintWriter;ILjava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V
 Landroid/os/BatteryStats;->getUidStats()Landroid/util/SparseArray;
 Landroid/os/BatteryStats$HistoryItem;->CMD_UPDATE:B
 Landroid/os/BatteryStats$HistoryItem;->states2:I
@@ -1425,7 +1368,6 @@
 Landroid/os/BatteryStats$Uid$Proc;->getUserTime(I)J
 Landroid/os/BatteryStats$Uid$Sensor;->getHandle()I
 Landroid/os/BatteryStats$Uid$Sensor;->getSensorTime()Landroid/os/BatteryStats$Timer;
-Landroid/os/BestClock;-><init>(Ljava/time/ZoneId;[Ljava/time/Clock;)V
 Landroid/os/Binder;->execTransact(IJJI)Z
 Landroid/os/Binder;->mObject:J
 Landroid/os/Build;->getString(Ljava/lang/String;)Ljava/lang/String;
@@ -1466,7 +1408,6 @@
 Landroid/os/Debug$MemoryInfo;->otherSwappedOut:I
 Landroid/os/Debug$MemoryInfo;->otherSwappedOutPss:I
 Landroid/os/Environment;->buildExternalStorageAppDataDirs(Ljava/lang/String;)[Ljava/io/File;
-Landroid/os/Environment;->buildPaths([Ljava/io/File;[Ljava/lang/String;)[Ljava/io/File;
 Landroid/os/Environment;->getVendorDirectory()Ljava/io/File;
 Landroid/os/Environment;->maybeTranslateEmulatedPathToInternal(Ljava/io/File;)Ljava/io/File;
 Landroid/os/FileObserver$ObserverThread;->onEvent(IILjava/lang/String;)V
@@ -1540,7 +1481,6 @@
 Landroid/os/Process;->readProcFile(Ljava/lang/String;[I[Ljava/lang/String;[J[F)Z
 Landroid/os/Process;->readProcLines(Ljava/lang/String;[Ljava/lang/String;[J)V
 Landroid/os/Process;->setArgV0(Ljava/lang/String;)V
-Landroid/os/RecoverySystem;->bootCommand(Landroid/content/Context;[Ljava/lang/String;)V
 Landroid/os/SELinux;->isSELinuxEnabled()Z
 Landroid/os/SELinux;->isSELinuxEnforced()Z
 Landroid/os/ServiceManager;->addService(Ljava/lang/String;Landroid/os/IBinder;)V
@@ -1591,7 +1531,6 @@
 Landroid/os/SystemProperties;->native_get(Ljava/lang/String;)Ljava/lang/String;
 Landroid/os/SystemProperties;->PROP_NAME_MAX:I
 Landroid/os/SystemProperties;->set(Ljava/lang/String;Ljava/lang/String;)V
-Landroid/os/SystemService;->waitForAnyStopped([Ljava/lang/String;)V
 Landroid/os/Trace;->asyncTraceBegin(JLjava/lang/String;I)V
 Landroid/os/Trace;->asyncTraceEnd(JLjava/lang/String;I)V
 Landroid/os/Trace;->isTagEnabled(J)Z
@@ -1703,7 +1642,6 @@
 Landroid/preference/Preference;->performClick(Landroid/preference/PreferenceScreen;)V
 Landroid/preference/PreferenceScreen;->mRootAdapter:Landroid/widget/ListAdapter;
 Landroid/print/PrinterId;->getServiceName()Landroid/content/ComponentName;
-Landroid/print/PrintFileDocumentAdapter$WriteFileAsyncTask;->doInBackground([Ljava/lang/Void;)Ljava/lang/Void;
 Landroid/print/PrintJobInfo;->getAdvancedOptions()Landroid/os/Bundle;
 Landroid/print/PrintJobInfo;->getDocumentInfo()Landroid/print/PrintDocumentInfo;
 Landroid/provider/Browser$BookmarkColumns;->DATE:Ljava/lang/String;
@@ -1945,8 +1883,6 @@
 Landroid/R$styleable;->Window:[I
 Landroid/R$styleable;->Window_windowBackground:I
 Landroid/R$styleable;->Window_windowFrame:I
-Landroid/security/Credentials;->convertToPem([Ljava/security/cert/Certificate;)[B
-Landroid/security/keymaster/KeymasterArguments;->addEnums(I[I)V
 Landroid/security/keystore/AndroidKeyStoreProvider;->getKeyStoreOperationHandle(Ljava/lang/Object;)J
 Landroid/security/KeyStore;->getInstance()Landroid/security/KeyStore;
 Landroid/security/net/config/RootTrustManager;->checkServerTrusted([Ljava/security/cert/X509Certificate;Ljava/lang/String;Ljava/lang/String;)Ljava/util/List;
@@ -1961,11 +1897,9 @@
 Landroid/service/notification/NotificationListenerService;->unregisterAsSystemService()V
 Landroid/service/notification/StatusBarNotification;->getUid()I
 Landroid/service/voice/AlwaysOnHotwordDetector$EventPayload;->getCaptureSession()Ljava/lang/Integer;
-Landroid/service/voice/AlwaysOnHotwordDetector$RefreshAvailabiltyTask;->doInBackground([Ljava/lang/Void;)Ljava/lang/Void;
 Landroid/service/voice/VoiceInteractionService;->isKeyphraseAndLocaleSupportedForHotword(Ljava/lang/String;Ljava/util/Locale;)Z
 Landroid/service/vr/IVrManager;->getVr2dDisplayId()I
 Landroid/service/wallpaper/WallpaperService$Engine;->setFixedSizeAllowed(Z)V
-Landroid/speech/tts/TextToSpeech$Connection$SetupConnectionAsyncTask;->doInBackground([Ljava/lang/Void;)Ljava/lang/Integer;
 Landroid/speech/tts/TextToSpeech;->getCurrentEngine()Ljava/lang/String;
 Landroid/system/Int32Ref;->value:I
 Landroid/system/OsConstants;->AF_NETLINK:I
@@ -2024,24 +1958,6 @@
 Landroid/system/OsConstants;->XATTR_REPLACE:I
 Landroid/system/StructTimeval;->fromMillis(J)Landroid/system/StructTimeval;
 Landroid/telecom/AudioState;->isMuted:Z
-Landroid/telecom/Log;->addEvent(Landroid/telecom/Logging/EventManager$Loggable;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V
-Landroid/telecom/Log;->buildMessage(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
-Landroid/telecom/Log;->d(Ljava/lang/Object;Ljava/lang/String;[Ljava/lang/Object;)V
-Landroid/telecom/Log;->d(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V
-Landroid/telecom/Log;->e(Ljava/lang/Object;Ljava/lang/Throwable;Ljava/lang/String;[Ljava/lang/Object;)V
-Landroid/telecom/Log;->e(Ljava/lang/String;Ljava/lang/Throwable;Ljava/lang/String;[Ljava/lang/Object;)V
-Landroid/telecom/Logging/EventManager;->event(Landroid/telecom/Logging/EventManager$Loggable;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V
-Landroid/telecom/Log;->i(Ljava/lang/Object;Ljava/lang/String;[Ljava/lang/Object;)V
-Landroid/telecom/Log;->i(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V
-Landroid/telecom/Log;->v(Ljava/lang/Object;Ljava/lang/String;[Ljava/lang/Object;)V
-Landroid/telecom/Log;->v(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V
-Landroid/telecom/Log;->w(Ljava/lang/Object;Ljava/lang/String;[Ljava/lang/Object;)V
-Landroid/telecom/Log;->w(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V
-Landroid/telecom/Log;->wtf(Ljava/lang/Object;Ljava/lang/String;[Ljava/lang/Object;)V
-Landroid/telecom/Log;->wtf(Ljava/lang/Object;Ljava/lang/Throwable;Ljava/lang/String;[Ljava/lang/Object;)V
-Landroid/telecom/Log;->wtf(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V
-Landroid/telecom/Log;->wtf(Ljava/lang/String;Ljava/lang/Throwable;Ljava/lang/String;[Ljava/lang/Object;)V
-Landroid/telecom/Response;->onResult(Ljava/lang/Object;[Ljava/lang/Object;)V
 Landroid/telecom/TelecomManager;->EXTRA_IS_HANDOVER:Ljava/lang/String;
 Landroid/telecom/TelecomManager;->getUserSelectedOutgoingPhoneAccount()Landroid/telecom/PhoneAccountHandle;
 Landroid/telecom/TelecomManager;->setUserSelectedOutgoingPhoneAccount(Landroid/telecom/PhoneAccountHandle;)V
@@ -2197,7 +2113,6 @@
 Landroid/transition/ChangeBounds;->BOTTOM_RIGHT_ONLY_PROPERTY:Landroid/util/Property;
 Landroid/transition/ChangeBounds;->POSITION_PROPERTY:Landroid/util/Property;
 Landroid/transition/TransitionManager;->sRunningTransitions:Ljava/lang/ThreadLocal;
-Landroid/transition/TransitionUtils;->mergeTransitions([Landroid/transition/Transition;)Landroid/transition/Transition;
 Landroid/util/ArrayMap;->append(Ljava/lang/Object;Ljava/lang/Object;)V
 Landroid/util/ArrayMap;->mBaseCacheSize:I
 Landroid/util/ArrayMap;->mTwiceBaseCacheSize:I
@@ -2677,7 +2592,6 @@
 Landroid/widget/AbsSeekBar;->mThumb:Landroid/graphics/drawable/Drawable;
 Landroid/widget/AbsSeekBar;->mTouchProgressOffset:F
 Landroid/widget/ActivityChooserModel;->get(Landroid/content/Context;Ljava/lang/String;)Landroid/widget/ActivityChooserModel;
-Landroid/widget/ActivityChooserModel$PersistHistoryAsyncTask;->doInBackground([Ljava/lang/Object;)Ljava/lang/Void;
 Landroid/widget/ActivityChooserView;->setExpandActivityOverflowButtonDrawable(Landroid/graphics/drawable/Drawable;)V
 Landroid/widget/AdapterView;->mDataChanged:Z
 Landroid/widget/AdapterView;->mFirstPosition:I
@@ -2706,7 +2620,6 @@
 Landroid/widget/Editor;->mShowSoftInputOnFocus:Z
 Landroid/widget/ExpandableListView;->mChildDivider:Landroid/graphics/drawable/Drawable;
 Landroid/widget/ExpandableListView;->mGroupIndicator:Landroid/graphics/drawable/Drawable;
-Landroid/widget/FastScroller;->groupAnimatorOfFloat(Landroid/util/Property;F[Landroid/view/View;)Landroid/animation/Animator;
 Landroid/widget/FastScroller;->mContainerRect:Landroid/graphics/Rect;
 Landroid/widget/FastScroller;->mHeaderCount:I
 Landroid/widget/FastScroller;->mLongList:Z
@@ -2797,7 +2710,6 @@
 Landroid/widget/ProgressBar;->mMaxHeight:I
 Landroid/widget/ProgressBar;->mMinHeight:I
 Landroid/widget/ProgressBar;->mOnlyIndeterminate:Z
-Landroid/widget/RelativeLayout$DependencyGraph;->getSortedViews([Landroid/view/View;[I)V
 Landroid/widget/RelativeLayout$LayoutParams;->mBottom:I
 Landroid/widget/RelativeLayout$LayoutParams;->mLeft:I
 Landroid/widget/RelativeLayout$LayoutParams;->mRight:I
@@ -2807,7 +2719,6 @@
 Landroid/widget/RemoteViews$Action;->viewId:I
 Landroid/widget/RemoteViewsAdapter;->mCache:Landroid/widget/RemoteViewsAdapter$FixedSizeRemoteViewsCache;
 Landroid/widget/RemoteViewsAdapter;->mWorkerThread:Landroid/os/HandlerThread;
-Landroid/widget/RemoteViews$AsyncApplyTask;->doInBackground([Ljava/lang/Void;)Landroid/widget/RemoteViews$ViewTree;
 Landroid/widget/RemoteViews$BitmapCache;->mBitmaps:Ljava/util/ArrayList;
 Landroid/widget/RemoteViews$BitmapReflectionAction;->bitmap:Landroid/graphics/Bitmap;
 Landroid/widget/RemoteViews$BitmapReflectionAction;->methodName:Ljava/lang/String;
@@ -2838,7 +2749,6 @@
 Landroid/widget/SearchView;->mSearchSrcTextView:Landroid/widget/SearchView$SearchAutoComplete;
 Landroid/widget/SearchView;->onCloseClicked()V
 Landroid/widget/SearchView;->setQuery(Ljava/lang/CharSequence;)V
-Landroid/widget/SelectionActionModeHelper$TextClassificationAsyncTask;->doInBackground([Ljava/lang/Void;)Landroid/widget/SelectionActionModeHelper$SelectionResult;
 Landroid/widget/SlidingDrawer;->mTopOffset:I
 Landroid/widget/Spinner;->mPopup:Landroid/widget/Spinner$SpinnerPopup;
 Landroid/widget/Switch;->mThumbDrawable:Landroid/graphics/drawable/Drawable;
@@ -3262,16 +3172,9 @@
 Lcom/android/internal/view/menu/MenuPopupHelper;->mForceShowIcon:Z
 Lcom/android/internal/view/menu/MenuPopupHelper;->setForceShowIcon(Z)V
 Lcom/android/internal/view/menu/MenuView$ItemView;->getItemData()Lcom/android/internal/view/menu/MenuItemImpl;
-Lcom/android/okhttp/CertificatePinner$Builder;->add(Ljava/lang/String;[Ljava/lang/String;)Lcom/android/okhttp/CertificatePinner$Builder;
-Lcom/android/okhttp/CertificatePinner;->check(Ljava/lang/String;[Ljava/security/cert/Certificate;)V
 Lcom/android/okhttp/ConnectionPool;->keepAliveDurationNs:J
 Lcom/android/okhttp/ConnectionPool;->maxIdleConnections:I
 Lcom/android/okhttp/ConnectionPool;->systemDefault:Lcom/android/okhttp/ConnectionPool;
-Lcom/android/okhttp/ConnectionSpec$Builder;->cipherSuites([Lcom/android/okhttp/CipherSuite;)Lcom/android/okhttp/ConnectionSpec$Builder;
-Lcom/android/okhttp/ConnectionSpec$Builder;->cipherSuites([Ljava/lang/String;)Lcom/android/okhttp/ConnectionSpec$Builder;
-Lcom/android/okhttp/ConnectionSpec$Builder;->tlsVersions([Lcom/android/okhttp/TlsVersion;)Lcom/android/okhttp/ConnectionSpec$Builder;
-Lcom/android/okhttp/ConnectionSpec$Builder;->tlsVersions([Ljava/lang/String;)Lcom/android/okhttp/ConnectionSpec$Builder;
-Lcom/android/okhttp/Headers;->of([Ljava/lang/String;)Lcom/android/okhttp/Headers;
 Lcom/android/okhttp/HttpUrl;->encodedPath()Ljava/lang/String;
 Lcom/android/okhttp/HttpUrl;->query()Ljava/lang/String;
 Lcom/android/okhttp/internal/http/HttpEngine;->httpStream:Lcom/android/okhttp/internal/http/HttpStream;
@@ -3279,13 +3182,11 @@
 Lcom/android/okhttp/internal/http/HttpEngine;->networkRequest(Lcom/android/okhttp/Request;)Lcom/android/okhttp/Request;
 Lcom/android/okhttp/internal/http/HttpEngine;->priorResponse:Lcom/android/okhttp/Response;
 Lcom/android/okhttp/internal/http/HttpEngine;->userResponse:Lcom/android/okhttp/Response;
-Lcom/android/okhttp/internal/NamedRunnable;-><init>(Ljava/lang/String;[Ljava/lang/Object;)V
 Lcom/android/okhttp/OkHttpClient;->connectionPool:Lcom/android/okhttp/ConnectionPool;
 Lcom/android/okhttp/OkHttpClient;->DEFAULT_PROTOCOLS:Ljava/util/List;
 Lcom/android/okhttp/OkHttpClient;->dns:Lcom/android/okhttp/Dns;
 Lcom/android/okhttp/OkHttpClient;->setProtocols(Ljava/util/List;)Lcom/android/okhttp/OkHttpClient;
 Lcom/android/okhttp/OkHttpClient;->setRetryOnConnectionFailure(Z)V
-Lcom/android/okhttp/okio/ByteString;->of([B)Lcom/android/okhttp/okio/ByteString;
 Lcom/android/okhttp/Request;->headers:Lcom/android/okhttp/Headers;
 Lcom/android/okhttp/Request;->method:Ljava/lang/String;
 Lcom/android/okhttp/Request;->url:Lcom/android/okhttp/HttpUrl;
@@ -3406,7 +3307,6 @@
 Ljava/lang/AbstractStringBuilder;->value:[C
 Ljava/lang/Boolean;->value:Z
 Ljava/lang/Byte;->value:B
-Ljava/lang/Character$UnicodeBlock;-><init>(Ljava/lang/String;[Ljava/lang/String;)V
 Ljava/lang/Character;->value:C
 Ljava/lang/Class;->accessFlags:I
 Ljava/lang/Class;->dexCache:Ljava/lang/Object;
@@ -3435,12 +3335,9 @@
 Ljava/lang/ref/FinalizerReference;->next:Ljava/lang/ref/FinalizerReference;
 Ljava/lang/ref/FinalizerReference;->queue:Ljava/lang/ref/ReferenceQueue;
 Ljava/lang/ref/FinalizerReference;->remove(Ljava/lang/ref/FinalizerReference;)V
-Ljava/lang/reflect/Constructor;->newInstance0([Ljava/lang/Object;)Ljava/lang/Object;
 Ljava/lang/reflect/Executable;->artMethod:J
 Ljava/lang/reflect/Parameter;-><init>(Ljava/lang/String;ILjava/lang/reflect/Executable;I)V
-Ljava/lang/reflect/Proxy;->getProxyClass0(Ljava/lang/ClassLoader;[Ljava/lang/Class;)Ljava/lang/Class;
 Ljava/lang/reflect/Proxy;->invoke(Ljava/lang/reflect/Proxy;Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object;
-Ljava/lang/ref/Reference;->getReferent()Ljava/lang/Object;
 Ljava/lang/ref/ReferenceQueue;->add(Ljava/lang/ref/Reference;)V
 Ljava/lang/ref/Reference;->referent:Ljava/lang/Object;
 Ljava/lang/Runtime;->loadLibrary(Ljava/lang/String;Ljava/lang/ClassLoader;)V
@@ -3448,9 +3345,7 @@
 Ljava/lang/Runtime;->mLibPaths:[Ljava/lang/String;
 Ljava/lang/Runtime;->nativeLoad(Ljava/lang/String;Ljava/lang/ClassLoader;)Ljava/lang/String;
 Ljava/lang/Short;->value:S
-Ljava/lang/String;->getCharsNoCheck(II[CI)V
 Ljava/lang/String;-><init>(II[C)V
-Ljava/lang/System;->arraycopy([CI[CII)V
 Ljava/lang/System;->arraycopy([II[III)V
 Ljava/lang/System;-><init>()V
 Ljava/lang/Thread;->daemon:Z
@@ -3519,9 +3414,6 @@
 Ljava/nio/ByteBuffer;->offset:I
 Ljava/nio/charset/CharsetEncoder;->canEncode(Ljava/nio/CharBuffer;)Z
 Ljava/nio/DirectByteBuffer;-><init>(JI)V
-Ljava/nio/file/Files;->createAndCheckIsDirectory(Ljava/nio/file/Path;[Ljava/nio/file/attribute/FileAttribute;)V
-Ljava/nio/file/Files;->followLinks([Ljava/nio/file/LinkOption;)Z
-Ljava/nio/file/Files;->isAccessible(Ljava/nio/file/Path;[Ljava/nio/file/AccessMode;)Z
 Ljava/nio/NIOAccess;->getBaseArray(Ljava/nio/Buffer;)Ljava/lang/Object;
 Ljava/nio/NIOAccess;->getBaseArrayOffset(Ljava/nio/Buffer;)I
 Ljava/nio/NIOAccess;->getBasePointer(Ljava/nio/Buffer;)J
@@ -3562,7 +3454,6 @@
 Ljava/util/concurrent/ThreadPoolExecutor;->allowCoreThreadTimeOut:Z
 Ljava/util/EnumMap;->keyType:Ljava/lang/Class;
 Ljava/util/EnumSet;->elementType:Ljava/lang/Class;
-Ljava/util/Formatter$FormatSpecifier;->checkBadFlags([Ljava/util/Formatter$Flags;)V
 Ljava/util/HashMap$HashIterator;->hasNext()Z
 Ljava/util/HashMap;->modCount:I
 Ljava/util/HashMap;->table:[Ljava/util/HashMap$Node;
@@ -3572,8 +3463,6 @@
 Ljava/util/LinkedHashMap$LinkedHashIterator;->hasNext()Z
 Ljava/util/LinkedList;->size:I
 Ljava/util/Locale;->createConstant(Ljava/lang/String;Ljava/lang/String;)Ljava/util/Locale;
-Ljava/util/logging/LogManager$Beans;->getConstructor(Ljava/lang/Class;[Ljava/lang/Class;)Ljava/lang/reflect/Constructor;
-Ljava/util/logging/LogManager$Beans;->getMethod(Ljava/lang/Class;Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;
 Ljava/util/PriorityQueue;->modCount:I
 Ljava/util/PriorityQueue;->size:I
 Ljava/util/Random;->seedUniquifier()J
@@ -3608,8 +3497,3 @@
 Lorg/json/JSONObject;->writeTo(Lorg/json/JSONStringer;)V
 Lorg/w3c/dom/traversal/NodeIterator;->nextNode()Lorg/w3c/dom/Node;
 Lsun/misc/Unsafe;->theUnsafe:Lsun/misc/Unsafe;
-Lsun/security/x509/AlgorithmId;->oid([I)Lsun/security/util/ObjectIdentifier;
-Lsun/util/logging/PlatformLogger$DefaultLoggerProxy;->doLog(Lsun/util/logging/PlatformLogger$Level;Ljava/lang/String;[Ljava/lang/Object;)V
-Lsun/util/logging/PlatformLogger$DefaultLoggerProxy;->formatMessage(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
-Lsun/util/logging/PlatformLogger$JavaLoggerProxy;->doLog(Lsun/util/logging/PlatformLogger$Level;Ljava/lang/String;[Ljava/lang/Object;)V
-Lsun/util/logging/PlatformLogger$LoggerProxy;->doLog(Lsun/util/logging/PlatformLogger$Level;Ljava/lang/String;[Ljava/lang/Object;)V
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 50a4398..82c3383 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -5873,7 +5873,7 @@
         } finally {
             // If the app targets < O-MR1, or doesn't change the thread policy
             // during startup, clobber the policy to maintain behavior of b/36951662
-            if (data.appInfo.targetSdkVersion <= Build.VERSION_CODES.O
+            if (data.appInfo.targetSdkVersion < Build.VERSION_CODES.O_MR1
                     || StrictMode.getThreadPolicy().equals(writesAllowedPolicy)) {
                 StrictMode.setThreadPolicy(savedPolicy);
             }
diff --git a/core/java/android/app/WallpaperManager.java b/core/java/android/app/WallpaperManager.java
index 17bc6ea..6c2fb2d 100644
--- a/core/java/android/app/WallpaperManager.java
+++ b/core/java/android/app/WallpaperManager.java
@@ -413,7 +413,7 @@
                 } catch (OutOfMemoryError e) {
                     Log.w(TAG, "Out of memory loading the current wallpaper: " + e);
                 } catch (SecurityException e) {
-                    if (context.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.O) {
+                    if (context.getApplicationInfo().targetSdkVersion < Build.VERSION_CODES.O_MR1) {
                         Log.w(TAG, "No permission to access wallpaper, suppressing"
                                 + " exception to avoid crashing legacy app.");
                     } else {
@@ -977,7 +977,7 @@
             } catch (RemoteException e) {
                 throw e.rethrowFromSystemServer();
             } catch (SecurityException e) {
-                if (mContext.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.O) {
+                if (mContext.getApplicationInfo().targetSdkVersion < Build.VERSION_CODES.O_MR1) {
                     Log.w(TAG, "No permission to access wallpaper, suppressing"
                             + " exception to avoid crashing legacy app.");
                     return null;
diff --git a/core/java/android/app/slice/Slice.java b/core/java/android/app/slice/Slice.java
index 4336f18..aadf904 100644
--- a/core/java/android/app/slice/Slice.java
+++ b/core/java/android/app/slice/Slice.java
@@ -197,6 +197,7 @@
     /**
      * Key to retrieve an extra added to an intent when the value of a slider is changed.
      * @deprecated remove once support lib is update to use EXTRA_RANGE_VALUE instead
+     * @removed
      */
     @Deprecated
     public static final String EXTRA_SLIDER_VALUE = "android.app.slice.extra.SLIDER_VALUE";
@@ -224,6 +225,7 @@
     /**
      * Subtype to tag an item as representing a slider.
      * @deprecated remove once support lib is update to use SUBTYPE_RANGE instead
+     * @removed
      */
     @Deprecated
     public static final String SUBTYPE_SLIDER = "slider";
@@ -360,6 +362,7 @@
 
         /**
          * @deprecated TO BE REMOVED
+         * @removed
          */
         @Deprecated
         public Builder(@NonNull Uri uri) {
@@ -388,7 +391,7 @@
 
         /**
          * Tells the system whether for this slice the return value of
-         * {@link SliceProvider#onBindSlice(Uri, List)} may be different depending on
+         * {@link SliceProvider#onBindSlice(Uri, java.util.Set)} may be different depending on
          * {@link SliceProvider#getCallingPackage()} and should not be cached for multiple
          * apps.
          */
@@ -411,6 +414,7 @@
 
         /**
          * @deprecated TO BE REMOVED
+         * @removed
          */
         public Builder setSpec(SliceSpec spec) {
             mSpec = spec;
@@ -490,6 +494,7 @@
 
         /**
          * @deprecated TO BE REMOVED.
+         * @removed
          */
         @Deprecated
         public Slice.Builder addTimestamp(long time, @Nullable @SliceSubtype String subType,
diff --git a/core/java/android/app/slice/SliceItem.java b/core/java/android/app/slice/SliceItem.java
index 019ae49..c058a14 100644
--- a/core/java/android/app/slice/SliceItem.java
+++ b/core/java/android/app/slice/SliceItem.java
@@ -46,7 +46,7 @@
  * <li>{@link #FORMAT_IMAGE}</li>
  * <li>{@link #FORMAT_ACTION}</li>
  * <li>{@link #FORMAT_INT}</li>
- * <li>{@link #FORMAT_TIMESTAMP}</li>
+ * <li>{@link #FORMAT_LONG}</li>
  * <li>{@link #FORMAT_REMOTE_INPUT}</li>
  * <li>{@link #FORMAT_BUNDLE}</li>
  *
@@ -103,6 +103,7 @@
     public static final String FORMAT_LONG = "long";
     /**
      * @deprecated TO BE REMOVED
+     * @removed
      */
     @Deprecated
     public static final String FORMAT_TIMESTAMP = FORMAT_LONG;
@@ -168,7 +169,7 @@
      * <li>{@link #FORMAT_IMAGE}</li>
      * <li>{@link #FORMAT_ACTION}</li>
      * <li>{@link #FORMAT_INT}</li>
-     * <li>{@link #FORMAT_TIMESTAMP}</li>
+     * <li>{@link #FORMAT_LONG}</li>
      * <li>{@link #FORMAT_REMOTE_INPUT}</li>
      * <li>{@link #FORMAT_BUNDLE}</li>
      * @see #getSubType() ()
@@ -249,8 +250,17 @@
     }
 
     /**
-     * @return The timestamp held by this {@link #FORMAT_TIMESTAMP} SliceItem
+     * @return The long held by this {@link #FORMAT_LONG} SliceItem
      */
+    public long getLong() {
+        return (Long) mObj;
+    }
+
+    /**
+     * @deprecated replaced by {@link #getLong()}
+     * @removed
+     */
+    @Deprecated
     public long getTimestamp() {
         return (Long) mObj;
     }
diff --git a/core/java/android/app/slice/SliceManager.java b/core/java/android/app/slice/SliceManager.java
index ad49437..28e5938 100644
--- a/core/java/android/app/slice/SliceManager.java
+++ b/core/java/android/app/slice/SliceManager.java
@@ -139,6 +139,7 @@
 
     /**
      * @deprecated TO BE REMOVED
+     * @removed
      */
     @Deprecated
     public void pinSlice(@NonNull Uri uri, @NonNull List<SliceSpec> specs) {
@@ -263,6 +264,7 @@
 
     /**
      * @deprecated TO BE REMOVED
+     * @removed
      */
     @Deprecated
     public @Nullable Slice bindSlice(@NonNull Uri uri, @NonNull List<SliceSpec> supportedSpecs) {
@@ -354,7 +356,7 @@
 
     /**
      * Turns a slice intent into slice content. Is a shortcut to perform the action
-     * of both {@link #mapIntentToUri(Intent)} and {@link #bindSlice(Uri, List)} at once.
+     * of both {@link #mapIntentToUri(Intent)} and {@link #bindSlice(Uri, Set)} at once.
      *
      * @param intent The intent associated with a slice.
      * @param supportedSpecs List of supported specs.
@@ -397,6 +399,7 @@
 
     /**
      * @deprecated TO BE REMOVED.
+     * @removed
      */
     @Deprecated
     @Nullable
diff --git a/core/java/android/app/slice/SliceProvider.java b/core/java/android/app/slice/SliceProvider.java
index d369272..7d8e394 100644
--- a/core/java/android/app/slice/SliceProvider.java
+++ b/core/java/android/app/slice/SliceProvider.java
@@ -204,6 +204,7 @@
 
     /**
      * @deprecated TO BE REMOVED
+     * @removed
      */
     @Deprecated
     public Slice onBindSlice(Uri sliceUri, List<SliceSpec> supportedSpecs) {
diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java
index c5a39f4..d65e051 100644
--- a/core/java/android/content/pm/ApplicationInfo.java
+++ b/core/java/android/content/pm/ApplicationInfo.java
@@ -1694,7 +1694,7 @@
         if (mHiddenApiPolicy != HIDDEN_API_ENFORCEMENT_DEFAULT) {
             return mHiddenApiPolicy;
         }
-        if (targetSdkVersion <= Build.VERSION_CODES.O_MR1) {
+        if (targetSdkVersion < Build.VERSION_CODES.P) {
             return HIDDEN_API_ENFORCEMENT_BLACK;
         } else {
             return HIDDEN_API_ENFORCEMENT_DARK_GREY_AND_BLACK;
@@ -1728,9 +1728,9 @@
         if (isPackageWhitelistedForHiddenApis()) {
             return;
         }
-        if (targetSdkVersion <= Build.VERSION_CODES.O_MR1) {
+        if (targetSdkVersion < Build.VERSION_CODES.P) {
             setHiddenApiEnforcementPolicy(policyPreP);
-        } else if (targetSdkVersion > Build.VERSION_CODES.O_MR1) {
+        } else if (targetSdkVersion >= Build.VERSION_CODES.P) {
             setHiddenApiEnforcementPolicy(policyP);
         }
 
diff --git a/core/java/android/content/pm/PackageInfo.java b/core/java/android/content/pm/PackageInfo.java
index 627ceb7..5f9f8f1 100644
--- a/core/java/android/content/pm/PackageInfo.java
+++ b/core/java/android/content/pm/PackageInfo.java
@@ -244,7 +244,7 @@
      * the first position to be the same across updates.
      *
      * <strong>Deprecated</strong> This has been replaced by the
-     * {@link PackageInfo#signingCertificateHistory} field, which takes into
+     * {@link PackageInfo#signingInfo} field, which takes into
      * account signing certificate rotation.  For backwards compatibility in
      * the event of signing certificate rotation, this will return the oldest
      * reported signing certificate, so that an application will appear to
@@ -256,29 +256,15 @@
     public Signature[] signatures;
 
     /**
-     * Array of all signatures arrays read from the package file, potentially
+     * Signing information read from the package file, potentially
      * including past signing certificates no longer used after signing
-     * certificate rotation.  Though signing certificate rotation is only
-     * available for apps with a single signing certificate, this provides an
-     * array of arrays so that packages signed with multiple signing
-     * certificates can still return all signers.  This is only filled in if
+     * certificate rotation.  This is only filled in if
      * the flag {@link PackageManager#GET_SIGNING_CERTIFICATES} was set.
      *
-     * A package must be singed with at least one certificate, which is at
-     * position zero in the array.  An application may be signed by multiple
-     * certificates, which would be in the array at position zero in an
-     * indeterminate order.  A package may also have a history of certificates
-     * due to signing certificate rotation.  In this case, the array will be
-     * populated by a series of single-entry arrays corresponding to a signing
-     * certificate of the package.
-     *
-     * <strong>Note:</strong> Signature ordering is not guaranteed to be
-     * stable which means that a package signed with certificates A and B is
-     * equivalent to being signed with certificates B and A. This means that
-     * in case multiple signatures are reported you cannot assume the one at
-     * the first position will be the same across updates.
+     * Use this field instead of the deprecated {@code signatures} field.
+     * See {@link SigningInfo} for more information on its contents.
      */
-    public Signature[][] signingCertificateHistory;
+    public SigningInfo signingInfo;
 
     /**
      * Application specified preferred configuration
@@ -476,17 +462,11 @@
         dest.writeBoolean(mOverlayIsStatic);
         dest.writeInt(compileSdkVersion);
         dest.writeString(compileSdkVersionCodename);
-        writeSigningCertificateHistoryToParcel(dest, parcelableFlags);
-    }
-
-    private void writeSigningCertificateHistoryToParcel(Parcel dest, int parcelableFlags) {
-        if (signingCertificateHistory != null) {
-            dest.writeInt(signingCertificateHistory.length);
-            for (int i = 0; i < signingCertificateHistory.length; i++) {
-                dest.writeTypedArray(signingCertificateHistory[i], parcelableFlags);
-            }
+        if (signingInfo != null) {
+            dest.writeInt(1);
+            signingInfo.writeToParcel(dest, parcelableFlags);
         } else {
-            dest.writeInt(-1);
+            dest.writeInt(0);
         }
     }
 
@@ -544,7 +524,10 @@
         mOverlayIsStatic = source.readBoolean();
         compileSdkVersion = source.readInt();
         compileSdkVersionCodename = source.readString();
-        readSigningCertificateHistoryFromParcel(source);
+        int hasSigningInfo = source.readInt();
+        if (hasSigningInfo != 0) {
+            signingInfo = SigningInfo.CREATOR.createFromParcel(source);
+        }
 
         // The component lists were flattened with the redundant ApplicationInfo
         // instances omitted.  Distribute the canonical one here as appropriate.
@@ -556,16 +539,6 @@
         }
     }
 
-    private void readSigningCertificateHistoryFromParcel(Parcel source) {
-        int len = source.readInt();
-        if (len != -1) {
-            signingCertificateHistory = new Signature[len][];
-            for (int i = 0; i < len; i++) {
-                signingCertificateHistory[i] = source.createTypedArray(Signature.CREATOR);
-            }
-        }
-    }
-
     private void propagateApplicationInfo(ApplicationInfo appInfo, ComponentInfo[] components) {
         if (components != null) {
             for (ComponentInfo ci : components) {
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index 3e0db60..453a74a 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -810,21 +810,11 @@
 
         // replacement for GET_SIGNATURES
         if ((flags & PackageManager.GET_SIGNING_CERTIFICATES) != 0) {
-            if (p.mSigningDetails.hasPastSigningCertificates()) {
-                // Package has included signing certificate rotation information.  Convert each
-                // entry to an array
-                int numberOfSigs = p.mSigningDetails.pastSigningCertificates.length;
-                pi.signingCertificateHistory = new Signature[numberOfSigs][];
-                for (int i = 0; i < numberOfSigs; i++) {
-                    pi.signingCertificateHistory[i] =
-                            new Signature[] { p.mSigningDetails.pastSigningCertificates[i] };
-                }
-            } else if (p.mSigningDetails.hasSignatures()) {
-                // otherwise keep old behavior
-                int numberOfSigs = p.mSigningDetails.signatures.length;
-                pi.signingCertificateHistory = new Signature[1][numberOfSigs];
-                System.arraycopy(p.mSigningDetails.signatures, 0,
-                        pi.signingCertificateHistory[0], 0, numberOfSigs);
+            if (p.mSigningDetails != SigningDetails.UNKNOWN) {
+                // only return a valid SigningInfo if there is signing information to report
+                pi.signingInfo = new SigningInfo(p.mSigningDetails);
+            } else {
+                pi.signingInfo = null;
             }
         }
         return pi;
@@ -2726,7 +2716,7 @@
 
         // Fot apps targeting O-MR1 we require explicit enumeration of all certs.
         String[] additionalCertSha256Digests = EmptyArray.STRING;
-        if (pkg.applicationInfo.targetSdkVersion > Build.VERSION_CODES.O) {
+        if (pkg.applicationInfo.targetSdkVersion >= Build.VERSION_CODES.O_MR1) {
             additionalCertSha256Digests = parseAdditionalCertificates(res, parser, outError);
             if (additionalCertSha256Digests == null) {
                 return false;
diff --git a/core/java/android/content/pm/PackageSharedLibraryUpdater.java b/core/java/android/content/pm/PackageSharedLibraryUpdater.java
index fa89432..b14b321 100644
--- a/core/java/android/content/pm/PackageSharedLibraryUpdater.java
+++ b/core/java/android/content/pm/PackageSharedLibraryUpdater.java
@@ -62,7 +62,7 @@
 
     static boolean apkTargetsApiLevelLessThanOrEqualToOMR1(PackageParser.Package pkg) {
         int targetSdkVersion = pkg.applicationInfo.targetSdkVersion;
-        return targetSdkVersion <= Build.VERSION_CODES.O_MR1;
+        return targetSdkVersion < Build.VERSION_CODES.P;
     }
 
     /**
diff --git a/core/java/android/content/pm/SigningInfo.java b/core/java/android/content/pm/SigningInfo.java
new file mode 100644
index 0000000..ef87403
--- /dev/null
+++ b/core/java/android/content/pm/SigningInfo.java
@@ -0,0 +1,139 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.content.pm;
+
+
+import android.annotation.NonNull;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * Information pertaining to the signing certificates used to sign a package.
+ */
+public final class SigningInfo implements Parcelable {
+
+    @NonNull
+    private final PackageParser.SigningDetails mSigningDetails;
+
+    public SigningInfo() {
+        mSigningDetails = PackageParser.SigningDetails.UNKNOWN;
+    }
+
+    /**
+     * @hide only packagemanager should be populating this
+     */
+    public SigningInfo(PackageParser.SigningDetails signingDetails) {
+        mSigningDetails = new PackageParser.SigningDetails(signingDetails);
+    }
+
+    public SigningInfo(SigningInfo orig) {
+        mSigningDetails = new PackageParser.SigningDetails(orig.mSigningDetails);
+    }
+
+    private SigningInfo(Parcel source) {
+        mSigningDetails = PackageParser.SigningDetails.CREATOR.createFromParcel(source);
+    }
+
+    /**
+     * Although relatively uncommon, packages may be signed by more than one signer, in which case
+     * their identity is viewed as being the set of all signers, not just any one.
+     */
+    public boolean hasMultipleSigners() {
+        return mSigningDetails.signatures != null && mSigningDetails.signatures.length > 1;
+    }
+
+    /**
+     * APK Signature Scheme v3 enables packages to provide a proof-of-rotation record that the
+     * platform verifies, and uses, to allow the use of new signing certificates.  This is only
+     * available to packages that are not signed by multiple signers.  In the event of a change to a
+     * new signing certificate, the package's past signing certificates are presented as well.  Any
+     * check of a package's signing certificate should also include a search through its entire
+     * signing history, since it could change to a new signing certificate at any time.
+     */
+    public boolean hasPastSigningCertificates() {
+        return mSigningDetails.signatures != null
+                && mSigningDetails.pastSigningCertificates != null;
+    }
+
+    /**
+     * Returns the signing certificates this package has proven it is authorized to use. This
+     * includes both the signing certificate associated with the signer of the package and the past
+     * signing certificates it included as its proof of signing certificate rotation.  This method
+     * is the preferred replacement for the {@code GET_SIGNATURES} flag used with {@link
+     * PackageManager#getPackageInfo(String, int)}.  When determining if a package is signed by a
+     * desired certificate, the returned array should be checked to determine if it is one of the
+     * entries.
+     *
+     * <note>
+     *     This method returns null if the package is signed by multiple signing certificates, as
+     *     opposed to being signed by one current signer and also providing the history of past
+     *     signing certificates.  {@link #hasMultipleSigners()} may be used to determine if this
+     *     package is signed by multiple signers.  Packages which are signed by multiple signers
+     *     cannot change their signing certificates and their {@code Signature} array should be
+     *     checked to make sure that every entry matches the looked-for signing certificates.
+     * </note>
+     */
+    public Signature[] getSigningCertificateHistory() {
+        if (hasMultipleSigners()) {
+            return null;
+        } else if (!hasPastSigningCertificates()) {
+
+            // this package is only signed by one signer with no history, return it
+            return mSigningDetails.signatures;
+        } else {
+
+            // this package has provided proof of past signing certificates, include them
+            return mSigningDetails.pastSigningCertificates;
+        }
+    }
+
+    /**
+     * Returns the signing certificates used to sign the APK contents of this application.  Not
+     * including any past signing certificates the package proved it is authorized to use.
+     * <note>
+     *     This method should not be used unless {@link #hasMultipleSigners()} returns true,
+     *     indicating that {@link #getSigningCertificateHistory()} cannot be used, otherwise {@link
+     *     #getSigningCertificateHistory()} should be preferred.
+     * </note>
+     */
+    public Signature[] getApkContentsSigners() {
+        return mSigningDetails.signatures;
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel dest, int parcelableFlags) {
+        mSigningDetails.writeToParcel(dest, parcelableFlags);
+    }
+
+    public static final Parcelable.Creator<SigningInfo> CREATOR =
+            new Parcelable.Creator<SigningInfo>() {
+        @Override
+        public SigningInfo createFromParcel(Parcel source) {
+            return new SigningInfo(source);
+        }
+
+        @Override
+        public SigningInfo[] newArray(int size) {
+            return new SigningInfo[size];
+        }
+    };
+}
diff --git a/core/java/android/net/NetworkCapabilities.java b/core/java/android/net/NetworkCapabilities.java
index c314a35..a8e8179 100644
--- a/core/java/android/net/NetworkCapabilities.java
+++ b/core/java/android/net/NetworkCapabilities.java
@@ -254,9 +254,8 @@
     /**
      * Indicates that this network is not congested.
      * <p>
-     * When a network is congested, the device should defer network traffic that
-     * can be done at a later time without breaking developer contracts.
-     * @hide
+     * When a network is congested, applications should defer network traffic
+     * that can be done at a later time, such as uploading analytics.
      */
     public static final int NET_CAPABILITY_NOT_CONGESTED = 20;
 
diff --git a/core/java/android/os/BatteryManager.java b/core/java/android/os/BatteryManager.java
index 6363161..954071a 100644
--- a/core/java/android/os/BatteryManager.java
+++ b/core/java/android/os/BatteryManager.java
@@ -353,4 +353,20 @@
     public static boolean isPlugWired(int plugType) {
         return plugType == BATTERY_PLUGGED_USB || plugType == BATTERY_PLUGGED_AC;
     }
+
+    /**
+     * Compute an approximation for how much time (in milliseconds) remains until the battery is
+     * fully charged. Returns -1 if no time can be computed: either there is not enough current
+     * data to make a decision or the battery is currently discharging.
+     *
+     * @return how much time is left, in milliseconds, until the battery is fully charged or -1 if
+     *         the computation fails
+     */
+    public long computeChargeTimeRemaining() {
+        try {
+            return mBatteryStats.computeChargeTimeRemaining();
+        } catch (RemoteException e) {
+            throw e.rethrowFromSystemServer();
+        }
+    }
 }
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java
index 6ebb102..1d232bf 100644
--- a/core/java/android/os/BatteryStats.java
+++ b/core/java/android/os/BatteryStats.java
@@ -3814,6 +3814,9 @@
                 final BatterySipper bs = sippers.get(i);
                 String label;
                 switch (bs.drainType) {
+                    case AMBIENT_DISPLAY:
+                        label = "ambi";
+                        break;
                     case IDLE:
                         label="idle";
                         break;
@@ -4975,6 +4978,9 @@
                 final BatterySipper bs = sippers.get(i);
                 pw.print(prefix);
                 switch (bs.drainType) {
+                    case AMBIENT_DISPLAY:
+                        pw.print("    Ambient display: ");
+                        break;
                     case IDLE:
                         pw.print("    Idle: ");
                         break;
@@ -7777,6 +7783,9 @@
                 int n = SystemProto.PowerUseItem.UNKNOWN_SIPPER;
                 int uid = 0;
                 switch (bs.drainType) {
+                    case AMBIENT_DISPLAY:
+                        n = SystemProto.PowerUseItem.AMBIENT_DISPLAY;
+                        break;
                     case IDLE:
                         n = SystemProto.PowerUseItem.IDLE;
                         break;
diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java
index 8378a82..7162b8a 100644
--- a/core/java/android/os/Build.java
+++ b/core/java/android/os/Build.java
@@ -907,6 +907,8 @@
          * <li>{@link android.app.Service#startForeground Service.startForeground} requires
          * that apps hold the permission
          * {@link android.Manifest.permission#FOREGROUND_SERVICE}.</li>
+         * <li>{@link android.widget.LinearLayout} will always remeasure weighted children,
+         * even if there is no excess space.</li>
          * </ul>
          */
         public static final int P = CUR_DEVELOPMENT; // STOPSHIP Replace with the real version.
diff --git a/core/java/android/os/EventLogTags.logtags b/core/java/android/os/EventLogTags.logtags
new file mode 100644
index 0000000..b143a74
--- /dev/null
+++ b/core/java/android/os/EventLogTags.logtags
@@ -0,0 +1,6 @@
+# See system/core/logcat/event.logtags for a description of the format of this file.
+
+option java_package android.os
+
+230000 service_manager_stats (call_count|1),(total_time|1|3),(duration|1|3)
+230001 service_manager_slow (time|1|3),(service|3)
diff --git a/core/java/android/os/ServiceManager.java b/core/java/android/os/ServiceManager.java
index 3be76d6..165276d 100644
--- a/core/java/android/os/ServiceManager.java
+++ b/core/java/android/os/ServiceManager.java
@@ -18,7 +18,9 @@
 
 import android.util.Log;
 
+import com.android.internal.annotations.GuardedBy;
 import com.android.internal.os.BinderInternal;
+import com.android.internal.util.StatLogger;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -26,9 +28,76 @@
 /** @hide */
 public final class ServiceManager {
     private static final String TAG = "ServiceManager";
+    private static final Object sLock = new Object();
+
     private static IServiceManager sServiceManager;
+
+    /**
+     * Cache for the "well known" services, such as WM and AM.
+     */
     private static HashMap<String, IBinder> sCache = new HashMap<String, IBinder>();
 
+    /**
+     * We do the "slow log" at most once every this interval.
+     */
+    private static final int SLOW_LOG_INTERVAL_MS = 5000;
+
+    /**
+     * We do the "stats log" at most once every this interval.
+     */
+    private static final int STATS_LOG_INTERVAL_MS = 5000;
+
+    /**
+     * Threshold in uS for a "slow" call, used on core UIDs. We use a more relax value to
+     * avoid logspam.
+     */
+    private static final long GET_SERVICE_SLOW_THRESHOLD_US_CORE =
+            SystemProperties.getInt("debug.servicemanager.slow_call_core_ms", 10) * 1000;
+
+    /**
+     * Threshold in uS for a "slow" call, used on non-core UIDs. We use a more relax value to
+     * avoid logspam.
+     */
+    private static final long GET_SERVICE_SLOW_THRESHOLD_US_NON_CORE =
+            SystemProperties.getInt("debug.servicemanager.slow_call_ms", 50) * 1000;
+
+    /**
+     * We log stats logging ever this many getService() calls.
+     */
+    private static final int GET_SERVICE_LOG_EVERY_CALLS_CORE =
+            SystemProperties.getInt("debug.servicemanager.log_calls_core", 100);
+
+    /**
+     * We log stats logging ever this many getService() calls.
+     */
+    private static final int GET_SERVICE_LOG_EVERY_CALLS_NON_CORE =
+            SystemProperties.getInt("debug.servicemanager.log_calls", 200);
+
+    @GuardedBy("sLock")
+    private static int sGetServiceAccumulatedUs;
+
+    @GuardedBy("sLock")
+    private static int sGetServiceAccumulatedCallCount;
+
+    @GuardedBy("sLock")
+    private static long sLastStatsLogUptime;
+
+    @GuardedBy("sLock")
+    private static long sLastSlowLogUptime;
+
+    @GuardedBy("sLock")
+    private static long sLastSlowLogActualTime;
+
+    interface Stats {
+        int GET_SERVICE = 0;
+
+        int COUNT = GET_SERVICE + 1;
+    }
+
+    public static final StatLogger sStatLogger = new StatLogger(new String[] {
+            "getService()",
+    });
+
     private static IServiceManager getIServiceManager() {
         if (sServiceManager != null) {
             return sServiceManager;
@@ -52,7 +121,7 @@
             if (service != null) {
                 return service;
             } else {
-                return Binder.allowBlocking(getIServiceManager().getService(name));
+                return Binder.allowBlocking(rawGetService(name));
             }
         } catch (RemoteException e) {
             Log.e(TAG, "error in getService", e);
@@ -177,4 +246,59 @@
             super("No service published for: " + name);
         }
     }
+
+    private static IBinder rawGetService(String name) throws RemoteException {
+        final long start = sStatLogger.getTime();
+
+        final IBinder binder = getIServiceManager().getService(name);
+
+        final int time = (int) sStatLogger.logDurationStat(Stats.GET_SERVICE, start);
+
+        final int myUid = Process.myUid();
+        final boolean isCore = UserHandle.isCore(myUid);
+
+        final long slowThreshold = isCore
+                ? GET_SERVICE_SLOW_THRESHOLD_US_CORE
+                : GET_SERVICE_SLOW_THRESHOLD_US_NON_CORE;
+
+        synchronized (sLock) {
+            sGetServiceAccumulatedUs += time;
+            sGetServiceAccumulatedCallCount++;
+
+            final long nowUptime = SystemClock.uptimeMillis();
+
+            // Was a slow call?
+            if (time >= slowThreshold) {
+                // We do a slow log:
+                // - At most once in every SLOW_LOG_INTERVAL_MS
+                // - OR it was slower than the previously logged slow call.
+                if ((nowUptime > (sLastSlowLogUptime + SLOW_LOG_INTERVAL_MS))
+                        || (sLastSlowLogActualTime < time)) {
+                    EventLogTags.writeServiceManagerSlow(time / 1000, name);
+
+                    sLastSlowLogUptime = nowUptime;
+                    sLastSlowLogActualTime = time;
+                }
+            }
+
+            // Every GET_SERVICE_LOG_EVERY_CALLS calls, log the total time spent in getService().
+
+            final int logInterval = isCore
+                    ? GET_SERVICE_LOG_EVERY_CALLS_CORE
+                    : GET_SERVICE_LOG_EVERY_CALLS_NON_CORE;
+
+            if ((sGetServiceAccumulatedCallCount >= logInterval)
+                    && (nowUptime >= (sLastStatsLogUptime + STATS_LOG_INTERVAL_MS))) {
+
+                EventLogTags.writeServiceManagerStats(
+                        sGetServiceAccumulatedCallCount, // Total # of getService() calls.
+                        sGetServiceAccumulatedUs / 1000, // Total time spent in getService() calls.
+                        (int) (nowUptime - sLastStatsLogUptime)); // Uptime duration since last log.
+                sGetServiceAccumulatedCallCount = 0;
+                sGetServiceAccumulatedUs = 0;
+                sLastStatsLogUptime = nowUptime;
+            }
+        }
+        return binder;
+    }
 }
diff --git a/core/java/android/security/keystore/recovery/KeyChainSnapshot.java b/core/java/android/security/keystore/recovery/KeyChainSnapshot.java
index 9334aa9..54f82f9 100644
--- a/core/java/android/security/keystore/recovery/KeyChainSnapshot.java
+++ b/core/java/android/security/keystore/recovery/KeyChainSnapshot.java
@@ -119,6 +119,7 @@
      * See implementation for binary key format.
      *
      * @deprecated Use {@link #getTrustedHardwareCertPath} instead.
+     * @removed
      */
     @Deprecated
     public @NonNull byte[] getTrustedHardwarePublicKey() {
diff --git a/core/java/android/security/keystore/recovery/RecoveryController.java b/core/java/android/security/keystore/recovery/RecoveryController.java
index b84843b..fa4964d 100644
--- a/core/java/android/security/keystore/recovery/RecoveryController.java
+++ b/core/java/android/security/keystore/recovery/RecoveryController.java
@@ -302,6 +302,7 @@
 
     /**
      * @deprecated Use {@link #initRecoveryService(String, byte[], byte[])} instead.
+     * @removed
      */
     @Deprecated
     @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE)
@@ -373,6 +374,7 @@
 
     /**
      * @deprecated Use {@link #getKeyChainSnapshot()}
+     * @removed
      */
     @Deprecated
     @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE)
@@ -449,6 +451,7 @@
 
     /**
      * @deprecated Use {@link #getAliases()}.
+     * @removed
      */
     @Deprecated
     @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE)
@@ -474,6 +477,7 @@
 
     /**
      * @deprecated Use {@link #setRecoveryStatus(String, int)}
+     * @removed
      */
     @Deprecated
     @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE)
@@ -508,6 +512,7 @@
 
     /**
      * @deprecated Use {@link #getRecoveryStatus(String)}.
+     * @removed
      */
     @Deprecated
     @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE)
@@ -600,7 +605,10 @@
      * @throws LockScreenRequiredException if the user has not set a lock screen. This is required
      *     to generate recoverable keys, as the snapshots are encrypted using a key derived from the
      *     lock screen.
+     * @deprecated Use {@link #generateKey(String)}
+     * @removed
      */
+    @Deprecated
     @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE)
     public byte[] generateAndStoreKey(@NonNull String alias, byte[] account)
             throws InternalRecoveryServiceException, LockScreenRequiredException {
@@ -609,6 +617,7 @@
 
     /**
      * @deprecated Use {@link #generateKey(String)}.
+     * @removed
      */
     @Deprecated
     @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE)
diff --git a/core/java/android/security/keystore/recovery/RecoverySession.java b/core/java/android/security/keystore/recovery/RecoverySession.java
index 8353389..dc2961b 100644
--- a/core/java/android/security/keystore/recovery/RecoverySession.java
+++ b/core/java/android/security/keystore/recovery/RecoverySession.java
@@ -79,6 +79,7 @@
 
     /**
      * @deprecated Use {@link #start(String, CertPath, byte[], byte[], List)} instead.
+     * @removed
      */
     @Deprecated
     @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE)
@@ -110,6 +111,7 @@
 
     /**
      * @deprecated Use {@link #start(String, CertPath, byte[], byte[], List)} instead.
+     * @removed
      */
     @Deprecated
     @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE)
@@ -199,6 +201,7 @@
 
     /**
      * @deprecated Use {@link #recoverKeyChainSnapshot(byte[], List)} instead.
+     * @removed
      */
     @Deprecated
     @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE)
diff --git a/core/java/android/security/keystore/recovery/WrappedApplicationKey.java b/core/java/android/security/keystore/recovery/WrappedApplicationKey.java
index 32952db..7f81d04 100644
--- a/core/java/android/security/keystore/recovery/WrappedApplicationKey.java
+++ b/core/java/android/security/keystore/recovery/WrappedApplicationKey.java
@@ -76,6 +76,7 @@
 
         /**
          * @deprecated AOSP does not associate keys with accounts. This may be done by system app.
+         * @removed
          */
         @Deprecated
         public Builder setAccount(@NonNull byte[] account) {
@@ -134,6 +135,7 @@
 
     /**
      * @deprecated AOSP does not associate keys with accounts. This may be done by system app.
+     * @removed
      */
     @Deprecated
     public @NonNull byte[] getAccount() {
diff --git a/core/java/android/service/notification/ZenModeConfig.java b/core/java/android/service/notification/ZenModeConfig.java
index daecea7..7b01f7a 100644
--- a/core/java/android/service/notification/ZenModeConfig.java
+++ b/core/java/android/service/notification/ZenModeConfig.java
@@ -83,7 +83,8 @@
     private static final int DAY_MINUTES = 24 * 60;
     private static final int ZERO_VALUE_MS = 10 * SECONDS_MS;
 
-    // Default allow categories set in readXml() from default_zen_mode_config.xml, fallback values:
+    // Default allow categories set in readXml() from default_zen_mode_config.xml,
+    // fallback/upgrade values:
     private static final boolean DEFAULT_ALLOW_ALARMS = true;
     private static final boolean DEFAULT_ALLOW_MEDIA = true;
     private static final boolean DEFAULT_ALLOW_SYSTEM = false;
@@ -97,7 +98,7 @@
     private static final int DEFAULT_SUPPRESSED_VISUAL_EFFECTS =
             Policy.getAllSuppressedVisualEffects();
 
-    public static final int XML_VERSION = 6;
+    public static final int XML_VERSION = 7;
     public static final String ZEN_TAG = "zen";
     private static final String ZEN_ATT_VERSION = "version";
     private static final String ZEN_ATT_USER = "user";
diff --git a/core/java/android/text/method/LinkMovementMethod.java b/core/java/android/text/method/LinkMovementMethod.java
index f332358..e60377b 100644
--- a/core/java/android/text/method/LinkMovementMethod.java
+++ b/core/java/android/text/method/LinkMovementMethod.java
@@ -219,7 +219,7 @@
                     links[0].onClick(widget);
                 } else if (action == MotionEvent.ACTION_DOWN) {
                     if (widget.getContext().getApplicationInfo().targetSdkVersion
-                            > Build.VERSION_CODES.O_MR1) {
+                            >= Build.VERSION_CODES.P) {
                         // Selection change will reposition the toolbar. Hide it for a few ms for a
                         // smoother transition.
                         widget.hideFloatingToolbar(HIDE_FLOATING_TOOLBAR_DELAY_MS);
diff --git a/core/java/android/util/RecurrenceRule.java b/core/java/android/util/RecurrenceRule.java
index 975ad48..9c89876 100644
--- a/core/java/android/util/RecurrenceRule.java
+++ b/core/java/android/util/RecurrenceRule.java
@@ -149,6 +149,10 @@
         }
     };
 
+    public boolean isRecurring() {
+        return period != null;
+    }
+
     @Deprecated
     public boolean isMonthly() {
         return start != null
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index b367dc7..71b6084 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -697,6 +697,7 @@
  * security policy. See also {@link MotionEvent#FLAG_WINDOW_IS_OBSCURED}.
  * </p>
  *
+ * @attr ref android.R.styleable#View_accessibilityHeading
  * @attr ref android.R.styleable#View_alpha
  * @attr ref android.R.styleable#View_background
  * @attr ref android.R.styleable#View_clickable
@@ -2955,7 +2956,7 @@
      *     1                             PFLAG3_SCREEN_READER_FOCUSABLE
      *    1                              PFLAG3_AGGREGATED_VISIBLE
      *   1                               PFLAG3_AUTOFILLID_EXPLICITLY_SET
-     *  1                                available
+     *  1                                PFLAG3_ACCESSIBILITY_HEADING
      * |-------|-------|-------|-------|
      */
 
@@ -3252,6 +3253,11 @@
      */
     private static final int PFLAG3_AUTOFILLID_EXPLICITLY_SET = 0x40000000;
 
+    /**
+     * Indicates if the View is a heading for accessibility purposes
+     */
+    private static final int PFLAG3_ACCESSIBILITY_HEADING = 0x80000000;
+
     /* End of masks for mPrivateFlags3 */
 
     /**
@@ -5475,6 +5481,8 @@
                 case R.styleable.View_outlineAmbientShadowColor:
                     setOutlineAmbientShadowColor(a.getColor(attr, Color.BLACK));
                     break;
+                case com.android.internal.R.styleable.View_accessibilityHeading:
+                    setAccessibilityHeading(a.getBoolean(attr, false));
             }
         }
 
@@ -8795,6 +8803,7 @@
         info.addAction(AccessibilityAction.ACTION_SHOW_ON_SCREEN);
         populateAccessibilityNodeInfoDrawingOrderInParent(info);
         info.setPaneTitle(mAccessibilityPaneTitle);
+        info.setHeading(isAccessibilityHeading());
     }
 
     /**
@@ -10782,11 +10791,37 @@
      *                              accessibility tools.
      */
     public void setScreenReaderFocusable(boolean screenReaderFocusable) {
+        updatePflags3AndNotifyA11yIfChanged(PFLAG3_SCREEN_READER_FOCUSABLE, screenReaderFocusable);
+    }
+
+    /**
+     * Gets whether this view is a heading for accessibility purposes.
+     *
+     * @return {@code true} if the view is a heading, {@code false} otherwise.
+     *
+     * @attr ref android.R.styleable#View_accessibilityHeading
+     */
+    public boolean isAccessibilityHeading() {
+        return (mPrivateFlags3 & PFLAG3_ACCESSIBILITY_HEADING) != 0;
+    }
+
+    /**
+     * Set if view is a heading for a section of content for accessibility purposes.
+     *
+     * @param isHeading {@code true} if the view is a heading, {@code false} otherwise.
+     *
+     * @attr ref android.R.styleable#View_accessibilityHeading
+     */
+    public void setAccessibilityHeading(boolean isHeading) {
+        updatePflags3AndNotifyA11yIfChanged(PFLAG3_ACCESSIBILITY_HEADING, isHeading);
+    }
+
+    private void updatePflags3AndNotifyA11yIfChanged(int mask, boolean newValue) {
         int pflags3 = mPrivateFlags3;
-        if (screenReaderFocusable) {
-            pflags3 |= PFLAG3_SCREEN_READER_FOCUSABLE;
+        if (newValue) {
+            pflags3 |= mask;
         } else {
-            pflags3 &= ~PFLAG3_SCREEN_READER_FOCUSABLE;
+            pflags3 &= ~mask;
         }
 
         if (pflags3 != mPrivateFlags3) {
diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java
index 6af678b..dac100a 100644
--- a/core/java/android/widget/Editor.java
+++ b/core/java/android/widget/Editor.java
@@ -39,6 +39,7 @@
 import android.graphics.Matrix;
 import android.graphics.Paint;
 import android.graphics.Path;
+import android.graphics.Point;
 import android.graphics.PointF;
 import android.graphics.Rect;
 import android.graphics.RectF;
@@ -4837,14 +4838,48 @@
             return true;
         }
 
-        private boolean handleOverlapsMagnifier() {
-            final int handleY = mContainer.getDecorViewLayoutParams().y;
-            final int magnifierBottomWhenAtWindowTop =
-                    mTextView.getRootWindowInsets().getSystemWindowInsetTop()
-                        + mMagnifierAnimator.mMagnifier.getHeight();
-            return handleY <= magnifierBottomWhenAtWindowTop;
+        private boolean handleOverlapsMagnifier(@NonNull final HandleView handle,
+                @NonNull final Rect magnifierRect) {
+            final PopupWindow window = handle.mContainer;
+            if (!window.hasDecorView()) {
+                return false;
+            }
+            final Rect handleRect = new Rect(
+                    window.getDecorViewLayoutParams().x,
+                    window.getDecorViewLayoutParams().y,
+                    window.getDecorViewLayoutParams().x + window.getContentView().getWidth(),
+                    window.getDecorViewLayoutParams().y + window.getContentView().getHeight());
+            return Rect.intersects(handleRect, magnifierRect);
         }
 
+        private @Nullable HandleView getOtherSelectionHandle() {
+            final SelectionModifierCursorController controller = getSelectionController();
+            if (controller == null || !controller.isActive()) {
+                return null;
+            }
+            return controller.mStartHandle != this
+                    ? controller.mStartHandle
+                    : controller.mEndHandle;
+        }
+
+        private final Magnifier.Callback mHandlesVisibilityCallback = new Magnifier.Callback() {
+            @Override
+            public void onOperationComplete() {
+                final Point magnifierTopLeft = mMagnifierAnimator.mMagnifier.getWindowCoords();
+                if (magnifierTopLeft == null) {
+                    return;
+                }
+                final Rect magnifierRect = new Rect(magnifierTopLeft.x, magnifierTopLeft.y,
+                        magnifierTopLeft.x + mMagnifierAnimator.mMagnifier.getWidth(),
+                        magnifierTopLeft.y + mMagnifierAnimator.mMagnifier.getHeight());
+                setVisible(!handleOverlapsMagnifier(HandleView.this, magnifierRect));
+                final HandleView otherHandle = getOtherSelectionHandle();
+                if (otherHandle != null) {
+                    otherHandle.setVisible(!handleOverlapsMagnifier(otherHandle, magnifierRect));
+                }
+            }
+        };
+
         protected final void updateMagnifier(@NonNull final MotionEvent event) {
             if (mMagnifierAnimator == null) {
                 return;
@@ -4858,12 +4893,8 @@
                 mRenderCursorRegardlessTiming = true;
                 mTextView.invalidateCursorPath();
                 suspendBlink();
-                // Hide handle if it overlaps the magnifier.
-                if (handleOverlapsMagnifier()) {
-                    setVisible(false);
-                } else {
-                    setVisible(true);
-                }
+                mMagnifierAnimator.mMagnifier
+                        .setOnOperationCompleteCallback(mHandlesVisibilityCallback);
 
                 mMagnifierAnimator.show(showPosInView.x, showPosInView.y);
             } else {
@@ -4877,6 +4908,10 @@
                 mRenderCursorRegardlessTiming = false;
                 resumeBlink();
                 setVisible(true);
+                final HandleView otherHandle = getOtherSelectionHandle();
+                if (otherHandle != null) {
+                    otherHandle.setVisible(true);
+                }
             }
         }
 
diff --git a/core/java/android/widget/LinearLayout.java b/core/java/android/widget/LinearLayout.java
index d32e93c..40f9652 100644
--- a/core/java/android/widget/LinearLayout.java
+++ b/core/java/android/widget/LinearLayout.java
@@ -217,6 +217,17 @@
 
     private int mLayoutDirection = View.LAYOUT_DIRECTION_UNDEFINED;
 
+    /**
+     * Signals that compatibility booleans have been initialized according to
+     * target SDK versions.
+     */
+    private static boolean sCompatibilityDone = false;
+
+    /**
+     * Behavior change in P; always remeasure weighted children, regardless of excess space.
+     */
+    private static boolean sRemeasureWeightedChildren = true;
+
     public LinearLayout(Context context) {
         this(context, null);
     }
@@ -232,6 +243,15 @@
     public LinearLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
         super(context, attrs, defStyleAttr, defStyleRes);
 
+        if (!sCompatibilityDone && context != null) {
+            final int targetSdkVersion = context.getApplicationInfo().targetSdkVersion;
+
+            // Older apps only remeasure non-zero children
+            sRemeasureWeightedChildren = targetSdkVersion >= Build.VERSION_CODES.P;
+
+            sCompatibilityDone = true;
+        }
+
         final TypedArray a = context.obtainStyledAttributes(
                 attrs, com.android.internal.R.styleable.LinearLayout, defStyleAttr, defStyleRes);
 
@@ -917,7 +937,8 @@
         // measurement on any children, we need to measure them now.
         int remainingExcess = heightSize - mTotalLength
                 + (mAllowInconsistentMeasurement ? 0 : consumedExcessSpace);
-        if (skippedMeasure || totalWeight > 0.0f) {
+        if (skippedMeasure
+                || ((sRemeasureWeightedChildren || remainingExcess != 0) && totalWeight > 0.0f)) {
             float remainingWeightSum = mWeightSum > 0.0f ? mWeightSum : totalWeight;
 
             mTotalLength = 0;
@@ -1300,7 +1321,8 @@
         // measurement on any children, we need to measure them now.
         int remainingExcess = widthSize - mTotalLength
                 + (mAllowInconsistentMeasurement ? 0 : usedExcessSpace);
-        if (skippedMeasure || totalWeight > 0.0f) {
+        if (skippedMeasure
+                || ((sRemeasureWeightedChildren || remainingExcess != 0) && totalWeight > 0.0f)) {
             float remainingWeightSum = mWeightSum > 0.0f ? mWeightSum : totalWeight;
 
             maxAscent[0] = maxAscent[1] = maxAscent[2] = maxAscent[3] = -1;
diff --git a/core/java/android/widget/Magnifier.java b/core/java/android/widget/Magnifier.java
index 5eb6699..cb362e6 100644
--- a/core/java/android/widget/Magnifier.java
+++ b/core/java/android/widget/Magnifier.java
@@ -233,6 +233,17 @@
         return mZoom;
     }
 
+    /**
+     * @hide
+     */
+    @Nullable
+    public Point getWindowCoords() {
+        if (mWindow == null) {
+            return null;
+        }
+        return new Point(mWindow.mLastDrawContentPositionX, mWindow.mLastDrawContentPositionY);
+    }
+
     @Nullable
     private Surface getValidViewSurface() {
         // TODO: deduplicate this against the first part of #performPixelCopy
@@ -374,8 +385,11 @@
         private final Runnable mMagnifierUpdater;
         // The handler where the magnifier updater jobs will be post'd.
         private final Handler mHandler;
-        // The callback to be run after the next draw. Only used for testing.
+        // The callback to be run after the next draw.
         private Callback mCallback;
+        // The position of the magnifier content when the last draw was requested.
+        private int mLastDrawContentPositionX;
+        private int mLastDrawContentPositionY;
 
         // Members below describe the state of the magnifier. Reads/writes to them
         // have to be synchronized between the UI thread and the thread that handles
@@ -598,6 +612,8 @@
                     callback = null;
                 }
 
+                mLastDrawContentPositionX = mWindowPositionX + mOffsetX;
+                mLastDrawContentPositionY = mWindowPositionY + mOffsetY;
                 mFrameDrawScheduled = false;
             }
 
diff --git a/core/java/android/widget/SelectionActionModeHelper.java b/core/java/android/widget/SelectionActionModeHelper.java
index 468abdc..1f2b90a 100644
--- a/core/java/android/widget/SelectionActionModeHelper.java
+++ b/core/java/android/widget/SelectionActionModeHelper.java
@@ -969,7 +969,7 @@
             mHot = true;
             trimText();
             final TextSelection selection;
-            if (mContext.getApplicationInfo().targetSdkVersion > Build.VERSION_CODES.O_MR1) {
+            if (mContext.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.P) {
                 final TextSelection.Request request = new TextSelection.Request.Builder(
                         mTrimmedText, mRelativeStart, mRelativeEnd)
                         .setDefaultLocales(mDefaultLocales)
@@ -1023,7 +1023,7 @@
 
                 trimText();
                 final TextClassification classification;
-                if (mContext.getApplicationInfo().targetSdkVersion > Build.VERSION_CODES.O_MR1) {
+                if (mContext.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.P) {
                     final TextClassification.Request request =
                             new TextClassification.Request.Builder(
                                     mTrimmedText, mRelativeStart, mRelativeEnd)
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index fae6db5d..7b9ecca 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -317,7 +317,6 @@
  * @attr ref android.R.styleable#TextView_autoSizeMaxTextSize
  * @attr ref android.R.styleable#TextView_autoSizeStepGranularity
  * @attr ref android.R.styleable#TextView_autoSizePresetSizes
- * @attr ref android.R.styleable#TextView_accessibilityHeading
  */
 @RemoteView
 public class TextView extends View implements ViewTreeObserver.OnPreDrawListener {
@@ -417,7 +416,6 @@
     private int mCurTextColor;
     private int mCurHintTextColor;
     private boolean mFreezesText;
-    private boolean mIsAccessibilityHeading;
 
     private Editable.Factory mEditableFactory = Editable.Factory.getInstance();
     private Spannable.Factory mSpannableFactory = Spannable.Factory.getInstance();
@@ -1294,8 +1292,6 @@
                 case com.android.internal.R.styleable.TextView_lineHeight:
                     lineHeight = a.getDimensionPixelSize(attr, -1);
                     break;
-                case com.android.internal.R.styleable.TextView_accessibilityHeading:
-                    mIsAccessibilityHeading = a.getBoolean(attr, false);
             }
         }
 
@@ -5213,32 +5209,6 @@
     }
 
     /**
-     * Gets whether this view is a heading for accessibility purposes.
-     *
-     * @return {@code true} if the view is a heading, {@code false} otherwise.
-     *
-     * @attr ref android.R.styleable#TextView_accessibilityHeading
-     */
-    public boolean isAccessibilityHeading() {
-        return mIsAccessibilityHeading;
-    }
-
-    /**
-     * Set if view is a heading for a section of content for accessibility purposes.
-     *
-     * @param isHeading {@code true} if the view is a heading, {@code false} otherwise.
-     *
-     * @attr ref android.R.styleable#TextView_accessibilityHeading
-     */
-    public void setAccessibilityHeading(boolean isHeading) {
-        if (isHeading != mIsAccessibilityHeading) {
-            mIsAccessibilityHeading = isHeading;
-            notifyViewAccessibilityStateChangedIfNeeded(
-                    AccessibilityEvent.CONTENT_CHANGE_TYPE_UNDEFINED);
-        }
-    }
-
-    /**
      * Convenience method to append the specified text to the TextView's
      * display buffer, upgrading it to {@link android.widget.TextView.BufferType#EDITABLE}
      * if it was not already editable.
@@ -10833,7 +10803,6 @@
         info.setText(getTextForAccessibility());
         info.setHintText(mHint);
         info.setShowingHintText(isShowingHint());
-        info.setHeading(mIsAccessibilityHeading);
 
         if (mBufferType == BufferType.EDITABLE) {
             info.setEditable(true);
diff --git a/core/java/com/android/internal/app/SuspendedAppActivity.java b/core/java/com/android/internal/app/SuspendedAppActivity.java
index 322c876..25af355 100644
--- a/core/java/com/android/internal/app/SuspendedAppActivity.java
+++ b/core/java/com/android/internal/app/SuspendedAppActivity.java
@@ -19,10 +19,10 @@
 import android.app.AlertDialog;
 import android.content.DialogInterface;
 import android.content.Intent;
+import android.content.pm.PackageManager;
 import android.os.Bundle;
 import android.os.UserHandle;
 import android.util.Slog;
-import android.view.Window;
 import android.view.WindowManager;
 
 import com.android.internal.R;
@@ -31,6 +31,10 @@
         implements DialogInterface.OnClickListener {
     private static final String TAG = "SuspendedAppActivity";
 
+    public static final String EXTRA_SUSPENDED_PACKAGE =
+            "SuspendedAppActivity.extra.SUSPENDED_PACKAGE";
+    public static final String EXTRA_SUSPENDING_PACKAGE =
+            "SuspendedAppActivity.extra.SUSPENDING_PACKAGE";
     public static final String EXTRA_DIALOG_MESSAGE = "SuspendedAppActivity.extra.DIALOG_MESSAGE";
     public static final String EXTRA_MORE_DETAILS_INTENT =
             "SuspendedAppActivity.extra.MORE_DETAILS_INTENT";
@@ -38,10 +42,19 @@
     private Intent mMoreDetailsIntent;
     private int mUserId;
 
+    private CharSequence getAppLabel(String packageName) {
+        final PackageManager pm = getPackageManager();
+        try {
+            return pm.getApplicationInfoAsUser(packageName, 0, mUserId).loadLabel(pm);
+        } catch (PackageManager.NameNotFoundException ne) {
+            Slog.e(TAG, "Package " + packageName + " not found", ne);
+        }
+        return packageName;
+    }
+
     @Override
     public void onCreate(Bundle icicle) {
-        Window window = getWindow();
-        window.setType(WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG);
+        getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG);
         super.onCreate(icicle);
 
         final Intent intent = getIntent();
@@ -52,15 +65,22 @@
             finish();
             return;
         }
-        String dialogMessage = intent.getStringExtra(EXTRA_DIALOG_MESSAGE);
-        if (dialogMessage == null) {
-            dialogMessage = getString(R.string.app_suspended_default_message);
+        final String suppliedMessage = intent.getStringExtra(EXTRA_DIALOG_MESSAGE);
+        final CharSequence suspendedAppLabel = getAppLabel(
+                intent.getStringExtra(EXTRA_SUSPENDED_PACKAGE));
+        final CharSequence dialogMessage;
+        if (suppliedMessage == null) {
+            dialogMessage = getString(R.string.app_suspended_default_message,
+                    suspendedAppLabel,
+                    getAppLabel(intent.getStringExtra(EXTRA_SUSPENDING_PACKAGE)));
+        } else {
+            dialogMessage = String.format(getResources().getConfiguration().getLocales().get(0),
+                    suppliedMessage, suspendedAppLabel);
         }
 
         final AlertController.AlertParams ap = mAlertParams;
         ap.mTitle = getString(R.string.app_suspended_title);
-        ap.mMessage = String.format(getResources().getConfiguration().getLocales().get(0),
-                dialogMessage, intent.getStringExtra(Intent.EXTRA_PACKAGE_NAME));
+        ap.mMessage = dialogMessage;
         ap.mPositiveButtonText = getString(android.R.string.ok);
         if (mMoreDetailsIntent != null) {
             ap.mNeutralButtonText = getString(R.string.app_suspended_more_details);
diff --git a/core/java/com/android/internal/util/StatLogger.java b/core/java/com/android/internal/util/StatLogger.java
new file mode 100644
index 0000000..1dac136
--- /dev/null
+++ b/core/java/com/android/internal/util/StatLogger.java
@@ -0,0 +1,173 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.internal.util;
+
+import android.os.SystemClock;
+import android.util.Slog;
+import android.util.proto.ProtoOutputStream;
+
+import com.android.internal.annotations.GuardedBy;
+import com.android.server.StatLoggerProto;
+import com.android.server.StatLoggerProto.Event;
+
+import java.io.PrintWriter;
+
+/**
+ * Simple class to keep track of the number of times certain events happened and their durations for
+ * benchmarking.
+ *
+ * @hide
+ */
+public class StatLogger {
+    private static final String TAG = "StatLogger";
+
+    private final Object mLock = new Object();
+
+    private final int SIZE;
+
+    @GuardedBy("mLock")
+    private final int[] mCountStats;
+
+    @GuardedBy("mLock")
+    private final long[] mDurationStats;
+
+    @GuardedBy("mLock")
+    private final int[] mCallsPerSecond;
+
+    @GuardedBy("mLock")
+    private final long[] mDurationPerSecond;
+
+    @GuardedBy("mLock")
+    private final int[] mMaxCallsPerSecond;
+
+    @GuardedBy("mLock")
+    private final long[] mMaxDurationPerSecond;
+
+    @GuardedBy("mLock")
+    private final long[] mMaxDurationStats;
+
+    @GuardedBy("mLock")
+    private long mNextTickTime = SystemClock.elapsedRealtime() + 1000;
+
+    private final String[] mLabels;
+
+    public StatLogger(String[] eventLabels) {
+        SIZE = eventLabels.length;
+        mCountStats = new int[SIZE];
+        mDurationStats = new long[SIZE];
+        mCallsPerSecond = new int[SIZE];
+        mMaxCallsPerSecond = new int[SIZE];
+        mDurationPerSecond = new long[SIZE];
+        mMaxDurationPerSecond = new long[SIZE];
+        mMaxDurationStats = new long[SIZE];
+        mLabels = eventLabels;
+    }
+
+    /**
+     * Return the current time in the internal time unit.
+     * Call it before an event happens, and
+     * give it back to the {@link #logDurationStat(int, long)}} after the event.
+     */
+    public long getTime() {
+        return SystemClock.elapsedRealtimeNanos() / 1000;
+    }
+
+    /**
+     * @see {@link #getTime()}
+     *
+     * @return the duration in microseconds.
+     */
+    public long logDurationStat(int eventId, long start) {
+        synchronized (mLock) {
+            final long duration = getTime() - start;
+            if (eventId >= 0 && eventId < SIZE) {
+                mCountStats[eventId]++;
+                mDurationStats[eventId] += duration;
+            } else {
+                Slog.wtf(TAG, "Invalid event ID: " + eventId);
+                return duration;
+            }
+            if (mMaxDurationStats[eventId] < duration) {
+                mMaxDurationStats[eventId] = duration;
+            }
+
+            // Keep track of the per-second max.
+            final long nowRealtime = SystemClock.elapsedRealtime();
+            if (nowRealtime > mNextTickTime) {
+                if (mMaxCallsPerSecond[eventId] < mCallsPerSecond[eventId]) {
+                    mMaxCallsPerSecond[eventId] = mCallsPerSecond[eventId];
+                }
+                if (mMaxDurationPerSecond[eventId] < mDurationPerSecond[eventId]) {
+                    mMaxDurationPerSecond[eventId] = mDurationPerSecond[eventId];
+                }
+
+                mCallsPerSecond[eventId] = 0;
+                mDurationPerSecond[eventId] = 0;
+
+                mNextTickTime = nowRealtime + 1000;
+            }
+
+            mCallsPerSecond[eventId]++;
+            mDurationPerSecond[eventId] += duration;
+
+            return duration;
+        }
+    }
+
+    public void dump(PrintWriter pw, String prefix) {
+        dump(new IndentingPrintWriter(pw, "  ").setIndent(prefix));
+    }
+
+    public void dump(IndentingPrintWriter pw) {
+        synchronized (mLock) {
+            pw.println("Stats:");
+            pw.increaseIndent();
+            for (int i = 0; i < SIZE; i++) {
+                final int count = mCountStats[i];
+                final double durationMs = mDurationStats[i] / 1000.0;
+
+                pw.println(String.format(
+                        "%s: count=%d, total=%.1fms, avg=%.3fms, max calls/s=%d max dur/s=%.1fms"
+                        + " max time=%.1fms",
+                        mLabels[i], count, durationMs,
+                        (count == 0 ? 0 : durationMs / count),
+                        mMaxCallsPerSecond[i], mMaxDurationPerSecond[i] / 1000.0,
+                        mMaxDurationStats[i] / 1000.0));
+            }
+            pw.decreaseIndent();
+        }
+    }
+
+    public void dumpProto(ProtoOutputStream proto, long fieldId) {
+        synchronized (mLock) {
+            final long outer = proto.start(fieldId);
+
+            for (int i = 0; i < mLabels.length; i++) {
+                final long inner = proto.start(StatLoggerProto.EVENTS);
+
+                proto.write(Event.EVENT_ID, i);
+                proto.write(Event.LABEL, mLabels[i]);
+                proto.write(Event.COUNT, mCountStats[i]);
+                proto.write(Event.TOTAL_DURATION_MICROS, mDurationStats[i]);
+
+                proto.end(inner);
+            }
+
+            proto.end(outer);
+        }
+    }
+}
diff --git a/core/java/com/android/internal/widget/FloatingToolbar.java b/core/java/com/android/internal/widget/FloatingToolbar.java
index 35aae15..2ce5a0b 100644
--- a/core/java/com/android/internal/widget/FloatingToolbar.java
+++ b/core/java/com/android/internal/widget/FloatingToolbar.java
@@ -1706,6 +1706,7 @@
         contentContainer.setLayoutParams(new ViewGroup.LayoutParams(
                 ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
         contentContainer.setTag(FLOATING_TOOLBAR_TAG);
+        contentContainer.setClipToOutline(true);
         return contentContainer;
     }
 
diff --git a/core/proto/android/app/activitymanager.proto b/core/proto/android/app/activitymanager.proto
index 4756c13..ead7e16 100644
--- a/core/proto/android/app/activitymanager.proto
+++ b/core/proto/android/app/activitymanager.proto
@@ -23,14 +23,14 @@
 
 // ActivityManager.java UID_OBSERVERs flags
 enum UidObserverFlag {
-  // report changes in process state, original value is 1 << 0
-  UID_OBSERVER_FLAG_PROCSTATE = 1;
-  // report uid gone, original value is 1 << 1
-  UID_OBSERVER_FLAG_GONE = 2;
-  // report uid has become idle, original value is 1 << 2
-  UID_OBSERVER_FLAG_IDLE = 3;
-  // report uid has become active, original value is 1 << 3
-  UID_OBSERVER_FLAG_ACTIVE = 4;
-  // report uid cached state has changed, original value is 1 << 4
-  UID_OBSERVER_FLAG_CACHED = 5;
+    // report changes in process state, original value is 1 << 0
+    UID_OBSERVER_FLAG_PROCSTATE = 1;
+    // report uid gone, original value is 1 << 1
+    UID_OBSERVER_FLAG_GONE = 2;
+    // report uid has become idle, original value is 1 << 2
+    UID_OBSERVER_FLAG_IDLE = 3;
+    // report uid has become active, original value is 1 << 3
+    UID_OBSERVER_FLAG_ACTIVE = 4;
+    // report uid cached state has changed, original value is 1 << 4
+    UID_OBSERVER_FLAG_CACHED = 5;
 }
diff --git a/core/proto/android/app/alarmmanager.proto b/core/proto/android/app/alarmmanager.proto
index 7ef08ca..53be1ee 100644
--- a/core/proto/android/app/alarmmanager.proto
+++ b/core/proto/android/app/alarmmanager.proto
@@ -27,31 +27,31 @@
  * An android.app.AlarmManager object.
  */
 message AlarmManagerProto {
-  enum AlarmType {
-    // Alarm time in System.currentTimeMillis() (wall clock time in UTC), which
-    // will wake up the device when it goes off.
-    RTC_WAKEUP = 0;
-    // Alarm time in System.currentTimeMillis() (wall clock time in UTC).  This
-    // alarm does not wake the device up; if it goes off while the device is
-    // asleep, it will not be delivered until the next time the device wakes up.
-    RTC = 1;
-    // Alarm time in SystemClock.elapsedRealtime() (time since boot, including
-    // sleep), which will wake up the device when it goes off.
-    ELAPSED_REALTIME_WAKEUP = 2;
-    // Alarm time in SystemClock.elapsedRealtime() (time since boot, including
-    // sleep). This alarm does not wake the device up; if it goes off while the
-    // device is asleep, it will not be delivered until the next time the device
-    // wakes up.
-    ELAPSED_REALTIME = 3;
-  }
+    enum AlarmType {
+        // Alarm time in System.currentTimeMillis() (wall clock time in UTC), which
+        // will wake up the device when it goes off.
+        RTC_WAKEUP = 0;
+        // Alarm time in System.currentTimeMillis() (wall clock time in UTC). This
+        // alarm does not wake the device up; if it goes off while the device is
+        // asleep, it will not be delivered until the next time the device wakes up.
+        RTC = 1;
+        // Alarm time in SystemClock.elapsedRealtime() (time since boot, including
+        // sleep), which will wake up the device when it goes off.
+        ELAPSED_REALTIME_WAKEUP = 2;
+        // Alarm time in SystemClock.elapsedRealtime() (time since boot, including
+        // sleep). This alarm does not wake the device up; if it goes off while the
+        // device is asleep, it will not be delivered until the next time the device
+        // wakes up.
+        ELAPSED_REALTIME = 3;
+    }
 }
 
 // An android.app.AlarmManager.AlarmClockInfo object.
 message AlarmClockInfoProto {
-  option (android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  // This value is UTC wall clock time in milliseconds, as returned by
-  // System#currentTimeMillis() for example.
-  optional int64 trigger_time_ms = 1;
-  optional android.app.PendingIntentProto show_intent = 2;
+    // This value is UTC wall clock time in milliseconds, as returned by
+    // System#currentTimeMillis() for example.
+    optional int64 trigger_time_ms = 1;
+    optional android.app.PendingIntentProto show_intent = 2;
 }
diff --git a/core/proto/android/app/job/enums.proto b/core/proto/android/app/job/enums.proto
index 17bf4fb..2290b2f 100644
--- a/core/proto/android/app/job/enums.proto
+++ b/core/proto/android/app/job/enums.proto
@@ -24,10 +24,10 @@
 // Reasons a job is stopped.
 // Primarily used in android.app.job.JobParameters.java.
 enum StopReasonEnum {
-  STOP_REASON_UNKNOWN = -1;
-  STOP_REASON_CANCELLED = 0;
-  STOP_REASON_CONSTRAINTS_NOT_SATISFIED = 1;
-  STOP_REASON_PREEMPT = 2;
-  STOP_REASON_TIMEOUT = 3;
-  STOP_REASON_DEVICE_IDLE = 4;
+    STOP_REASON_UNKNOWN = -1;
+    STOP_REASON_CANCELLED = 0;
+    STOP_REASON_CONSTRAINTS_NOT_SATISFIED = 1;
+    STOP_REASON_PREEMPT = 2;
+    STOP_REASON_TIMEOUT = 3;
+    STOP_REASON_DEVICE_IDLE = 4;
 }
diff --git a/core/proto/android/app/pendingintent.proto b/core/proto/android/app/pendingintent.proto
index ab0d34e..04ce850 100644
--- a/core/proto/android/app/pendingintent.proto
+++ b/core/proto/android/app/pendingintent.proto
@@ -26,7 +26,7 @@
  * An android.app.PendingIntent object.
  */
 message PendingIntentProto {
-  option (android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional string target = 1;
+    optional string target = 1;
 }
diff --git a/core/proto/android/app/statusbarmanager.proto b/core/proto/android/app/statusbarmanager.proto
index 3d1447a..1108508 100644
--- a/core/proto/android/app/statusbarmanager.proto
+++ b/core/proto/android/app/statusbarmanager.proto
@@ -19,15 +19,15 @@
 option java_multiple_files = true;
 
 message StatusBarManagerProto {
-  enum WindowState {
-    WINDOW_STATE_SHOWING = 0;
-    WINDOW_STATE_HIDING = 1;
-    WINDOW_STATE_HIDDEN = 2;
-  }
-  enum TransientWindowState {
-    TRANSIENT_BAR_NONE = 0;
-    TRANSIENT_BAR_SHOW_REQUESTED = 1;
-    TRANSIENT_BAR_SHOWING = 2;
-    TRANSIENT_BAR_HIDING = 3;
-  }
+    enum WindowState {
+        WINDOW_STATE_SHOWING = 0;
+        WINDOW_STATE_HIDING = 1;
+        WINDOW_STATE_HIDDEN = 2;
+    }
+    enum TransientWindowState {
+        TRANSIENT_BAR_NONE = 0;
+        TRANSIENT_BAR_SHOW_REQUESTED = 1;
+        TRANSIENT_BAR_SHOWING = 2;
+        TRANSIENT_BAR_HIDING = 3;
+    }
 }
diff --git a/core/proto/android/app/window_configuration.proto b/core/proto/android/app/window_configuration.proto
index 1e8ace4..c9f3986 100644
--- a/core/proto/android/app/window_configuration.proto
+++ b/core/proto/android/app/window_configuration.proto
@@ -25,9 +25,9 @@
 
 /** Proto representation for WindowConfiguration.java class. */
 message WindowConfigurationProto {
-  option (android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional .android.graphics.RectProto app_bounds = 1;
-  optional int32 windowing_mode = 2;
-  optional int32 activity_type = 3;
+    optional .android.graphics.RectProto app_bounds = 1;
+    optional int32 windowing_mode = 2;
+    optional int32 activity_type = 3;
 }
diff --git a/core/proto/android/bluetooth/enums.proto b/core/proto/android/bluetooth/enums.proto
index 9e459e6..d0c9226 100644
--- a/core/proto/android/bluetooth/enums.proto
+++ b/core/proto/android/bluetooth/enums.proto
@@ -22,22 +22,22 @@
 
 // Bluetooth connection states.
 enum ConnectionStateEnum {
-  CONNECTION_STATE_DISCONNECTED = 0;
-  CONNECTION_STATE_CONNECTING = 1;
-  CONNECTION_STATE_CONNECTED = 2;
-  CONNECTION_STATE_DISCONNECTING = 3;
+    CONNECTION_STATE_DISCONNECTED = 0;
+    CONNECTION_STATE_CONNECTING = 1;
+    CONNECTION_STATE_CONNECTED = 2;
+    CONNECTION_STATE_DISCONNECTING = 3;
 }
 
 // Bluetooth Adapter Enable and Disable Reasons
 enum EnableDisableReasonEnum {
-  ENABLE_DISABLE_REASON_UNSPECIFIED = 0;
-  ENABLE_DISABLE_REASON_APPLICATION_REQUEST = 1;
-  ENABLE_DISABLE_REASON_AIRPLANE_MODE = 2;
-  ENABLE_DISABLE_REASON_DISALLOWED = 3;
-  ENABLE_DISABLE_REASON_RESTARTED = 4;
-  ENABLE_DISABLE_REASON_START_ERROR = 5;
-  ENABLE_DISABLE_REASON_SYSTEM_BOOT = 6;
-  ENABLE_DISABLE_REASON_CRASH = 7;
-  ENABLE_DISABLE_REASON_USER_SWITCH = 8;
-  ENABLE_DISABLE_REASON_RESTORE_USER_SETTING = 9;
-}
\ No newline at end of file
+    ENABLE_DISABLE_REASON_UNSPECIFIED = 0;
+    ENABLE_DISABLE_REASON_APPLICATION_REQUEST = 1;
+    ENABLE_DISABLE_REASON_AIRPLANE_MODE = 2;
+    ENABLE_DISABLE_REASON_DISALLOWED = 3;
+    ENABLE_DISABLE_REASON_RESTARTED = 4;
+    ENABLE_DISABLE_REASON_START_ERROR = 5;
+    ENABLE_DISABLE_REASON_SYSTEM_BOOT = 6;
+    ENABLE_DISABLE_REASON_CRASH = 7;
+    ENABLE_DISABLE_REASON_USER_SWITCH = 8;
+    ENABLE_DISABLE_REASON_RESTORE_USER_SETTING = 9;
+}
diff --git a/core/proto/android/content/activityinfo.proto b/core/proto/android/content/activityinfo.proto
index 012752a..87acd84 100644
--- a/core/proto/android/content/activityinfo.proto
+++ b/core/proto/android/content/activityinfo.proto
@@ -19,24 +19,24 @@
 option java_multiple_files = true;
 
 message ActivityInfoProto {
-  enum ScreenOrientation {
-    SCREEN_ORIENTATION_UNSET = -2;
-    SCREEN_ORIENTATION_UNSPECIFIED = -1;
-    SCREEN_ORIENTATION_LANDSCAPE = 0;
-    SCREEN_ORIENTATION_PORTRAIT = 1;
-    SCREEN_ORIENTATION_USER = 2;
-    SCREEN_ORIENTATION_BEHIND = 3;
-    SCREEN_ORIENTATION_SENSOR = 4;
-    SCREEN_ORIENTATION_NOSENSOR = 5;
-    SCREEN_ORIENTATION_SENSOR_LANDSCAPE = 6;
-    SCREEN_ORIENTATION_SENSOR_PORTRAIT = 7;
-    SCREEN_ORIENTATION_REVERSE_LANDSCAPE = 8;
-    SCREEN_ORIENTATION_REVERSE_PORTRAIT = 9;
-    SCREEN_ORIENTATION_FULL_SENSOR = 10;
-    SCREEN_ORIENTATION_USER_LANDSCAPE = 11;
-    SCREEN_ORIENTATION_USER_PORTRAIT = 12;
-    SCREEN_ORIENTATION_FULL_USER = 13;
-    SCREEN_ORIENTATION_LOCKED = 14;
-  }
+    enum ScreenOrientation {
+        SCREEN_ORIENTATION_UNSET = -2;
+        SCREEN_ORIENTATION_UNSPECIFIED = -1;
+        SCREEN_ORIENTATION_LANDSCAPE = 0;
+        SCREEN_ORIENTATION_PORTRAIT = 1;
+        SCREEN_ORIENTATION_USER = 2;
+        SCREEN_ORIENTATION_BEHIND = 3;
+        SCREEN_ORIENTATION_SENSOR = 4;
+        SCREEN_ORIENTATION_NOSENSOR = 5;
+        SCREEN_ORIENTATION_SENSOR_LANDSCAPE = 6;
+        SCREEN_ORIENTATION_SENSOR_PORTRAIT = 7;
+        SCREEN_ORIENTATION_REVERSE_LANDSCAPE = 8;
+        SCREEN_ORIENTATION_REVERSE_PORTRAIT = 9;
+        SCREEN_ORIENTATION_FULL_SENSOR = 10;
+        SCREEN_ORIENTATION_USER_LANDSCAPE = 11;
+        SCREEN_ORIENTATION_USER_PORTRAIT = 12;
+        SCREEN_ORIENTATION_FULL_USER = 13;
+        SCREEN_ORIENTATION_LOCKED = 14;
+    }
 }
 
diff --git a/core/proto/android/content/configuration.proto b/core/proto/android/content/configuration.proto
index 6a174e8..5755c59 100644
--- a/core/proto/android/content/configuration.proto
+++ b/core/proto/android/content/configuration.proto
@@ -28,63 +28,63 @@
  * An android Configuration object.
  */
 message ConfigurationProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional float font_scale = 1;
-  optional uint32 mcc = 2;
-  optional uint32 mnc = 3 [ (.android.privacy).dest = DEST_EXPLICIT ];
-  repeated LocaleProto locales = 4;
-  optional uint32 screen_layout = 5;
-  optional uint32 color_mode = 6;
-  optional uint32 touchscreen = 7;
-  optional uint32 keyboard = 8;
-  optional uint32 keyboard_hidden = 9;
-  optional uint32 hard_keyboard_hidden = 10;
-  optional uint32 navigation = 11;
-  optional uint32 navigation_hidden = 12;
-  optional uint32 orientation = 13;
-  optional uint32 ui_mode = 14;
-  optional uint32 screen_width_dp = 15;
-  optional uint32 screen_height_dp = 16;
-  optional uint32 smallest_screen_width_dp = 17;
-  optional uint32 density_dpi = 18;
-  optional .android.app.WindowConfigurationProto window_configuration = 19;
+    optional float font_scale = 1;
+    optional uint32 mcc = 2;
+    optional uint32 mnc = 3 [ (.android.privacy).dest = DEST_EXPLICIT ];
+    repeated LocaleProto locales = 4;
+    optional uint32 screen_layout = 5;
+    optional uint32 color_mode = 6;
+    optional uint32 touchscreen = 7;
+    optional uint32 keyboard = 8;
+    optional uint32 keyboard_hidden = 9;
+    optional uint32 hard_keyboard_hidden = 10;
+    optional uint32 navigation = 11;
+    optional uint32 navigation_hidden = 12;
+    optional uint32 orientation = 13;
+    optional uint32 ui_mode = 14;
+    optional uint32 screen_width_dp = 15;
+    optional uint32 screen_height_dp = 16;
+    optional uint32 smallest_screen_width_dp = 17;
+    optional uint32 density_dpi = 18;
+    optional .android.app.WindowConfigurationProto window_configuration = 19;
 }
 
 /**
  * All current configuration data used to select resources.
  */
 message ResourcesConfigurationProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  required ConfigurationProto configuration = 1;
+    required ConfigurationProto configuration = 1;
 
-  optional uint32 sdk_version = 2;
-  optional uint32 screen_width_px = 3;
-  optional uint32 screen_height_px = 4;
+    optional uint32 sdk_version = 2;
+    optional uint32 screen_width_px = 3;
+    optional uint32 screen_height_px = 4;
 }
 
 /**
  * Overall device configuration data.
  */
 message DeviceConfigurationProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional uint32 stable_screen_width_px = 1;
-  optional uint32 stable_screen_height_px = 2;
-  optional uint32 stable_density_dpi = 3;
+    optional uint32 stable_screen_width_px = 1;
+    optional uint32 stable_screen_height_px = 2;
+    optional uint32 stable_density_dpi = 3;
 
-  optional uint64 total_ram = 4;
-  optional bool low_ram = 5;
-  optional uint32 max_cores = 6;
-  optional bool has_secure_screen_lock = 7;
+    optional uint64 total_ram = 4;
+    optional bool low_ram = 5;
+    optional uint32 max_cores = 6;
+    optional bool has_secure_screen_lock = 7;
 
-  optional uint32 opengl_version = 8;
-  repeated string opengl_extensions = 9;
+    optional uint32 opengl_version = 8;
+    repeated string opengl_extensions = 9;
 
-  repeated string shared_libraries = 10;
-  repeated string features = 11;
-  repeated string cpu_architectures = 12;
+    repeated string shared_libraries = 10;
+    repeated string features = 11;
+    repeated string cpu_architectures = 12;
 }
 
 /**
@@ -92,8 +92,8 @@
  * to filter and target apps.
  */
 message GlobalConfigurationProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional ResourcesConfigurationProto resources = 1;
-  optional DeviceConfigurationProto device = 2;
+    optional ResourcesConfigurationProto resources = 1;
+    optional DeviceConfigurationProto device = 2;
 }
diff --git a/core/proto/android/content/locale.proto b/core/proto/android/content/locale.proto
index 2be3ab9..87b555c 100644
--- a/core/proto/android/content/locale.proto
+++ b/core/proto/android/content/locale.proto
@@ -23,10 +23,10 @@
 package android.content;
 
 message LocaleProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional string language = 1;
-  optional string country = 2;
-  optional string variant = 3;
+    optional string language = 1;
+    optional string country = 2;
+    optional string variant = 3;
 }
 
diff --git a/core/proto/android/graphics/pixelformat.proto b/core/proto/android/graphics/pixelformat.proto
index 4e42c92..d7f5f0c 100644
--- a/core/proto/android/graphics/pixelformat.proto
+++ b/core/proto/android/graphics/pixelformat.proto
@@ -19,16 +19,16 @@
 option java_multiple_files = true;
 
 message PixelFormatProto {
-  enum Format {
-      UNKNOWN      = 0;
-      TRANSLUCENT  = -3;
-      TRANSPARENT  = -2;
-      OPAQUE       = -1;
-      RGBA_8888    = 1;
-      RGBX_8888    = 2;
-      RGB_888      = 3;
-      RGB_565      = 4;
-      RGBA_F16     = 0x16;
-      RGBA_1010102 = 0x2B;
-  }
+    enum Format {
+        UNKNOWN      = 0;
+        TRANSLUCENT  = -3;
+        TRANSPARENT  = -2;
+        OPAQUE       = -1;
+        RGBA_8888    = 1;
+        RGBX_8888    = 2;
+        RGB_888      = 3;
+        RGB_565      = 4;
+        RGBA_F16     = 0x16;
+        RGBA_1010102 = 0x2B;
+    }
 }
diff --git a/core/proto/android/graphics/point.proto b/core/proto/android/graphics/point.proto
index 035b9fe..04d879f 100644
--- a/core/proto/android/graphics/point.proto
+++ b/core/proto/android/graphics/point.proto
@@ -22,9 +22,9 @@
 option java_multiple_files = true;
 
 message PointProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional int32 x = 1;
-  optional int32 y = 2;
+    optional int32 x = 1;
+    optional int32 y = 2;
 }
 
diff --git a/core/proto/android/graphics/rect.proto b/core/proto/android/graphics/rect.proto
index eb403fe..c216b2b 100644
--- a/core/proto/android/graphics/rect.proto
+++ b/core/proto/android/graphics/rect.proto
@@ -22,11 +22,11 @@
 option java_multiple_files = true;
 
 message RectProto {
-  option (android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional int32 left = 1;
-  optional int32 top = 2;
-  optional int32 right = 3;
-  optional int32 bottom = 4;
+    optional int32 left = 1;
+    optional int32 top = 2;
+    optional int32 right = 3;
+    optional int32 bottom = 4;
 }
 
diff --git a/core/proto/android/internal/locallog.proto b/core/proto/android/internal/locallog.proto
index 73d1492..df0b90b 100644
--- a/core/proto/android/internal/locallog.proto
+++ b/core/proto/android/internal/locallog.proto
@@ -22,7 +22,7 @@
 import "frameworks/base/libs/incident/proto/android/privacy.proto";
 
 message LocalLogProto {
-  option (.android.msg_privacy).dest = DEST_EXPLICIT;
+    option (.android.msg_privacy).dest = DEST_EXPLICIT;
 
-  repeated string lines = 1;
+    repeated string lines = 1;
 }
diff --git a/core/proto/android/internal/processstats.proto b/core/proto/android/internal/processstats.proto
index 5629c2d..7c1ac3f 100644
--- a/core/proto/android/internal/processstats.proto
+++ b/core/proto/android/internal/processstats.proto
@@ -19,10 +19,10 @@
 package com.android.internal.app.procstats;
 
 message ProcessStatsProto {
-  enum MemoryFactor {
-    MEM_FACTOR_NORMAL = 0;
-    MEM_FACTOR_MODERATE = 1;
-    MEM_FACTOR_LOW = 2;
-    MEM_FACTOR_CRITICAL = 3;
-  }
+    enum MemoryFactor {
+        MEM_FACTOR_NORMAL = 0;
+        MEM_FACTOR_MODERATE = 1;
+        MEM_FACTOR_LOW = 2;
+        MEM_FACTOR_CRITICAL = 3;
+    }
 }
diff --git a/core/proto/android/os/batterystats.proto b/core/proto/android/os/batterystats.proto
index 8e98ac9..0970bd5 100644
--- a/core/proto/android/os/batterystats.proto
+++ b/core/proto/android/os/batterystats.proto
@@ -25,859 +25,860 @@
 import "frameworks/base/libs/incident/proto/android/privacy.proto";
 
 message BatteryStatsProto {
-  option (android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional int32 report_version = 1;
-  optional int64 parcel_version = 2;
-  optional string start_platform_version = 3;
-  optional string end_platform_version = 4;
-  repeated UidProto uids = 5;
-  optional SystemProto system = 6;
+    optional int32 report_version = 1;
+    optional int64 parcel_version = 2;
+    optional string start_platform_version = 3;
+    optional string end_platform_version = 4;
+    repeated UidProto uids = 5;
+    optional SystemProto system = 6;
 }
 
 message ControllerActivityProto {
-  option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
-  // Time (milliseconds) spent in the idle state.
-  optional int64 idle_duration_ms = 1;
-  // Time (milliseconds) spent in the receive state.
-  optional int64 rx_duration_ms = 2;
-  // Total power (mAh) consumed by the controller in all states. The value may
-  // always be 0 if the device doesn't support power calculations.
-  optional int64 power_mah = 3;
-
-  // Represents a transmit level, where each level may draw a different amount
-  // of power. The levels themselves are controller-specific (and may possibly
-  // be device specific...yet to be confirmed).
-  message TxLevel {
     option (android.msg_privacy).dest = DEST_AUTOMATIC;
 
-    // Transmit level. Higher levels draw more power.
-    optional int32 level = 1;
-    // Time spent in this specific transmit level state.
-    optional int64 duration_ms = 2;
-  }
-  repeated TxLevel tx = 4;
+    // Time (milliseconds) spent in the idle state.
+    optional int64 idle_duration_ms = 1;
+    // Time (milliseconds) spent in the receive state.
+    optional int64 rx_duration_ms = 2;
+    // Total power (mAh) consumed by the controller in all states. The value may
+    // always be 0 if the device doesn't support power calculations.
+    optional int64 power_mah = 3;
+
+    // Represents a transmit level, where each level may draw a different amount
+    // of power. The levels themselves are controller-specific (and may possibly
+    // be device specific...yet to be confirmed).
+    message TxLevel {
+        option (android.msg_privacy).dest = DEST_AUTOMATIC;
+
+        // Transmit level. Higher levels draw more power.
+        optional int32 level = 1;
+        // Time spent in this specific transmit level state.
+        optional int64 duration_ms = 2;
+    }
+    repeated TxLevel tx = 4;
 }
 
 message SystemProto {
-  option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
-  message Battery {
     option (android.msg_privacy).dest = DEST_AUTOMATIC;
 
-    // Wall clock time when the data collection started.
-    // In case of device time manually reset by users:
-    //   start_clock_time_ms keeps the same value in the current collection
-    //   period and changes for later collection periods.
-    optional int64 start_clock_time_ms = 1;
-    // #times the device has been started since start_clock_time_millis.
-    optional int64 start_count = 2;
-    // Total realtime duration (= SINCE_UNPLUGGED battery_realtime_millis.)
-    optional int64 total_realtime_ms = 3;
-    optional int64 total_uptime_ms = 4;
-    // Realtime duration on battery.
-    optional int64 battery_realtime_ms = 5;
-    // Uptime duration (i.e., not suspend).
-    // Uptime is anytime the CPUs were on. The radio and Wifi chip
-    // can be running while the CPUs are off.
-    optional int64 battery_uptime_ms = 6;
-    // Total realtime duration measured with screen off or dozing.
-    optional int64 screen_off_realtime_ms = 7;
-    // Total uptime duration measured with screen off or dozing.
-    optional int64 screen_off_uptime_ms = 8;
-    // Total time the screen was dozing while the device was running on battery.
-    // For historical reasons, screen_doze_duration_msec is a subset of
-    // screen_off_realtime_msec.
-    optional int64 screen_doze_duration_ms = 9;
-    // The estimated real battery capacity, which may be less than the declared
-    // battery capacity (for example, because of battery aging). This field is
-    // less reliable than min(max)_learned_battery_capacity_uah, use those two
-    // fields whenever possible.
-    optional int64 estimated_battery_capacity_mah = 10;
-    // The minimum learned battery capacity in uAh.
-    optional int64 min_learned_battery_capacity_uah = 11;
-    // The maximum learned battery capacity in uAh.
-    optional int64 max_learned_battery_capacity_uah = 12;
-  };
-  optional Battery battery = 1;
+    message Battery {
+        option (android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  message BatteryDischarge {
-    option (android.msg_privacy).dest = DEST_AUTOMATIC;
+        // Wall clock time when the data collection started.
+        // In case of device time manually reset by users:
+        //     start_clock_time_ms keeps the same value in the current collection
+        //     period and changes for later collection periods.
+        optional int64 start_clock_time_ms = 1;
+        // #times the device has been started since start_clock_time_millis.
+        optional int64 start_count = 2;
+        // Total realtime duration (= SINCE_UNPLUGGED battery_realtime_millis.)
+        optional int64 total_realtime_ms = 3;
+        optional int64 total_uptime_ms = 4;
+        // Realtime duration on battery.
+        optional int64 battery_realtime_ms = 5;
+        // Uptime duration (i.e., not suspend).
+        // Uptime is anytime the CPUs were on. The radio and Wifi chip
+        // can be running while the CPUs are off.
+        optional int64 battery_uptime_ms = 6;
+        // Total realtime duration measured with screen off or dozing.
+        optional int64 screen_off_realtime_ms = 7;
+        // Total uptime duration measured with screen off or dozing.
+        optional int64 screen_off_uptime_ms = 8;
+        // Total time the screen was dozing while the device was running on battery.
+        // For historical reasons, screen_doze_duration_msec is a subset of
+        // screen_off_realtime_msec.
+        optional int64 screen_doze_duration_ms = 9;
+        // The estimated real battery capacity, which may be less than the declared
+        // battery capacity (for example, because of battery aging). This field is
+        // less reliable than min(max)_learned_battery_capacity_uah, use those two
+        // fields whenever possible.
+        optional int64 estimated_battery_capacity_mah = 10;
+        // The minimum learned battery capacity in uAh.
+        optional int64 min_learned_battery_capacity_uah = 11;
+        // The maximum learned battery capacity in uAh.
+        optional int64 max_learned_battery_capacity_uah = 12;
+    };
+    optional Battery battery = 1;
 
-    // Discharged battery percentage points since the stats were last reset
-    // after charging (lower bound approximation).
-    optional int32 lower_bound_since_charge = 1;
-    // Upper bound approximation.
-    optional int32 upper_bound_since_charge = 2;
-    // Discharged points while screen is on.
-    optional int32 screen_on_since_charge = 3;
-    // Discharged points while screen is off.
-    optional int32 screen_off_since_charge = 4;
-    // Discharged points while screen was dozing. For historical reasons,
-    // screen_doze_since_charge is a subset of screen_off_since_charge.
-    optional int32 screen_doze_since_charge = 5;
-    // Total amount of battery discharged in mAh. This will only be non-zero for
-    // devices that report battery discharge via a coulomb counter.
-    optional int64 total_mah = 6;
-    // Total amount of battery discharged while the screen was off in mAh.
-    // This will only be non-zero for devices that report battery discharge
-    // via a coulomb counter.
-    optional int64 total_mah_screen_off = 7;
-    // Total amount of battery discharged while the screen was dozing in mAh.
-    // This will only be non-zero for devices that report battery discharge
-    // via a coulomb counter. For historical reasons, total_mah_screen_doze is
-    // a subset of total_mah_screen_off.
-    optional int64 total_mah_screen_doze = 8;
-    // Total amount of battery discharged in mAh while the device was in light doze mode.
-    // This will only be non-zero for devices that report battery discharge
-    // via a coulomb counter.
-    optional int64 total_mah_light_doze = 9;
-    // Total amount of battery discharged in mAh while the device was in deep doze mode.
-    // This will only be non-zero for devices that report battery discharge
-    // via a coulomb counter.
-    optional int64 total_mah_deep_doze = 10;
-  };
-  optional BatteryDischarge battery_discharge = 2;
+    message BatteryDischarge {
+        option (android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  oneof time_remaining {
-    // Approximation for how much time remains until the battery is fully
-    // charged. The device will print -1 if there wasn't enough data to
-    // calculate an estimate, or if the battery is currently discharging.
-    int64 charge_time_remaining_ms = 3;
-    // Approximation for how much time remains until the battery is fully
-    // discharged. The device will print -1 if there wasn't enough data to
-    // calculate an estimate, or if the battery is currently charging.
-    int64 discharge_time_remaining_ms = 4;
-  }
+        // Discharged battery percentage points since the stats were last reset
+        // after charging (lower bound approximation).
+        optional int32 lower_bound_since_charge = 1;
+        // Upper bound approximation.
+        optional int32 upper_bound_since_charge = 2;
+        // Discharged points while screen is on.
+        optional int32 screen_on_since_charge = 3;
+        // Discharged points while screen is off.
+        optional int32 screen_off_since_charge = 4;
+        // Discharged points while screen was dozing. For historical reasons,
+        // screen_doze_since_charge is a subset of screen_off_since_charge.
+        optional int32 screen_doze_since_charge = 5;
+        // Total amount of battery discharged in mAh. This will only be non-zero for
+        // devices that report battery discharge via a coulomb counter.
+        optional int64 total_mah = 6;
+        // Total amount of battery discharged while the screen was off in mAh.
+        // This will only be non-zero for devices that report battery discharge
+        // via a coulomb counter.
+        optional int64 total_mah_screen_off = 7;
+        // Total amount of battery discharged while the screen was dozing in mAh.
+        // This will only be non-zero for devices that report battery discharge
+        // via a coulomb counter. For historical reasons, total_mah_screen_doze is
+        // a subset of total_mah_screen_off.
+        optional int64 total_mah_screen_doze = 8;
+        // Total amount of battery discharged in mAh while the device was in light doze mode.
+        // This will only be non-zero for devices that report battery discharge
+        // via a coulomb counter.
+        optional int64 total_mah_light_doze = 9;
+        // Total amount of battery discharged in mAh while the device was in deep doze mode.
+        // This will only be non-zero for devices that report battery discharge
+        // via a coulomb counter.
+        optional int64 total_mah_deep_doze = 10;
+    };
+    optional BatteryDischarge battery_discharge = 2;
 
-  // BatteryLevelStep tracks data for which conditions were continuously held for
-  // the entire duration. Field for which the conditions were not consistent
-  // for the entire duration should be marked MIXED.
-  message BatteryLevelStep {
-    option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
-    // How long the battery was at the current level.
-    optional int64 duration_ms = 1;
-    // Battery level
-    optional int32 level = 2;
-
-    // State of the display. A special enum is used rather than
-    // DisplayProto.State because a MIXED value needs to be in the enum, and
-    // batterystats doesn't care about all of the different display states.
-    enum DisplayState {
-      DS_MIXED = 0;
-      DS_ON = 1;
-      DS_OFF = 2;
-      DS_DOZE = 3;
-      DS_DOZE_SUSPEND = 4;
-      // Any display state error that comes through should be sent to hackbod@.
-      DS_ERROR = 5;
+    oneof time_remaining {
+        // Approximation for how much time remains until the battery is fully
+        // charged. The device will print -1 if there wasn't enough data to
+        // calculate an estimate, or if the battery is currently discharging.
+        int64 charge_time_remaining_ms = 3;
+        // Approximation for how much time remains until the battery is fully
+        // discharged. The device will print -1 if there wasn't enough data to
+        // calculate an estimate, or if the battery is currently charging.
+        int64 discharge_time_remaining_ms = 4;
     }
-    // The state of the display for the entire battery level step. MIXED is used
-    // if there were multiple states for this step.
-    optional DisplayState display_state = 3;
 
-    // Indicates status in power save mode.
-    enum PowerSaveMode {
-      PSM_MIXED = 0;
-      PSM_ON = 1;
-      PSM_OFF = 2;
+    // BatteryLevelStep tracks data for which conditions were continuously held for
+    // the entire duration. Field for which the conditions were not consistent
+    // for the entire duration should be marked MIXED.
+    message BatteryLevelStep {
+        option (android.msg_privacy).dest = DEST_AUTOMATIC;
+
+        // How long the battery was at the current level.
+        optional int64 duration_ms = 1;
+        // Battery level
+        optional int32 level = 2;
+
+        // State of the display. A special enum is used rather than
+        // DisplayProto.State because a MIXED value needs to be in the enum, and
+        // batterystats doesn't care about all of the different display states.
+        enum DisplayState {
+            DS_MIXED = 0;
+            DS_ON = 1;
+            DS_OFF = 2;
+            DS_DOZE = 3;
+            DS_DOZE_SUSPEND = 4;
+            // Any display state error that comes through should be sent to hackbod@.
+            DS_ERROR = 5;
+        }
+        // The state of the display for the entire battery level step. MIXED is used
+        // if there were multiple states for this step.
+        optional DisplayState display_state = 3;
+
+        // Indicates status in power save mode.
+        enum PowerSaveMode {
+            PSM_MIXED = 0;
+            PSM_ON = 1;
+            PSM_OFF = 2;
+        }
+        // Battery Saver mode for the entire battery level step. MIXED is used
+        // if there were multiple states for this step.
+        optional PowerSaveMode power_save_mode = 4;
+
+        // Indicates status in idle mode.
+        enum IdleMode {
+            IM_MIXED = 0;
+            IM_ON = 2;
+            IM_OFF = 3;
+        }
+        // Doze mode for the entire battery level step. MIXED is used if there were
+        // multiple states for this step.
+        optional IdleMode idle_mode = 5;
+    };
+    // Battery level steps when the device was charging.
+    repeated BatteryLevelStep charge_step = 5;
+    // Battery level steps when the device was discharging.
+    repeated BatteryLevelStep discharge_step = 6;
+
+    // All CPU frequencies of the device.
+    repeated int64 cpu_frequency = 7;
+
+    message DataConnection {
+        option (android.msg_privacy).dest = DEST_AUTOMATIC;
+        oneof type {
+            android.telephony.NetworkTypeEnum name = 1;
+            // If is_none is not set, then the name is a valid network type.
+            bool is_none = 2;
+        }
+        optional TimerProto total = 3;
+    };
+    repeated DataConnection data_connection = 8;
+
+    optional ControllerActivityProto global_bluetooth_controller = 9;
+    optional ControllerActivityProto global_modem_controller = 10;
+    optional ControllerActivityProto global_wifi_controller = 11;
+
+    message GlobalNetwork {
+        option (android.msg_privacy).dest = DEST_AUTOMATIC;
+
+        // Total Bytes received on mobile connections.
+        optional int64 mobile_bytes_rx = 1;
+        // Total Bytes transmitted on mobile connections.
+        optional int64 mobile_bytes_tx = 2;
+        // Total Bytes received on wifi connections.
+        optional int64 wifi_bytes_rx = 3;
+        // Total Bytes transmitted on wifi connections.
+        optional int64 wifi_bytes_tx = 4;
+        // Total Packets received on mobile connections.
+        optional int64 mobile_packets_rx = 5;
+        // Total Packets transmitted on mobile connections.
+        optional int64 mobile_packets_tx = 6;
+        // Total Packets received on wifi connections.
+        optional int64 wifi_packets_rx = 7;
+        // Total Packets transmitted on wifi connections.
+        optional int64 wifi_packets_tx = 8;
+        // Total Bytes received on bluetooth connections.
+        optional int64 bt_bytes_rx = 9;
+        // Total Bytes transmitted on bluetooth connections.
+        optional int64 bt_bytes_tx = 10;
+    };
+    optional GlobalNetwork global_network = 12;
+
+    message GlobalWifi {
+        option (android.msg_privacy).dest = DEST_AUTOMATIC;
+
+        // The amount of time that wifi has been on while the device was running on
+        // battery.
+        optional int64 on_duration_ms = 1;
+        // The amount of time that wifi has been on and the driver has been in the
+        // running state while the device was running on battery.
+        optional int64 running_duration_ms = 2;
     }
-    // Battery Saver mode for the entire battery level step. MIXED is used
-    // if there were multiple states for this step.
-    optional PowerSaveMode power_save_mode = 4;
+    optional GlobalWifi global_wifi = 13;
 
-    // Indicates status in idle mode.
-    enum IdleMode {
-      IM_MIXED = 0;
-      IM_ON = 2;
-      IM_OFF = 3;
+    // Kernel wakelock metrics are only recorded when the device is unplugged
+    // *and* the screen is off.
+    message KernelWakelock {
+        option (android.msg_privacy).dest = DEST_AUTOMATIC;
+
+        optional string name = 1;
+        // Kernel wakelock stats aren't apportioned across all kernel wakelocks (as
+        // app wakelocks stats are).
+        optional TimerProto total = 2;
+        // The kernel doesn't have the data to enable printing out current and max
+        // durations.
+    };
+    repeated KernelWakelock kernel_wakelock = 14;
+
+    message Misc {
+        option (android.msg_privacy).dest = DEST_AUTOMATIC;
+
+        optional int64 screen_on_duration_ms = 1;
+        optional int64 phone_on_duration_ms = 2;
+        optional int64 full_wakelock_total_duration_ms = 3;
+        // The total elapsed time that a partial wakelock was held. This duration
+        // does not double count wakelocks held at the same time.
+        optional int64 partial_wakelock_total_duration_ms = 4;
+        optional int64 mobile_radio_active_duration_ms = 5;
+        // The time that is the difference between the mobile radio time we saw
+        // based on the elapsed timestamp when going down vs. the given time stamp
+        // from the radio.
+        optional int64 mobile_radio_active_adjusted_time_ms = 6;
+        optional int32 mobile_radio_active_count = 7;
+        // The amount of time that the mobile network has been active (in a high
+        // power state) but not being able to blame on an app.
+        optional int32 mobile_radio_active_unknown_duration_ms = 8;
+        // Total amount of time the device was in the interactive state.
+        optional int64 interactive_duration_ms = 9;
+        optional int64 battery_saver_mode_enabled_duration_ms = 10;
+        optional int32 num_connectivity_changes = 11;
+        // Amount of time the device was in deep Doze.
+        optional int64 deep_doze_enabled_duration_ms = 12;
+        // How many times the device went into deep Doze mode.
+        optional int32 deep_doze_count = 13;
+        // Amount of time the device was idling in deep Doze. Idling time
+        // encompasses "doze" time and the maintenance windows that allow apps to
+        // operate.
+        optional int64 deep_doze_idling_duration_ms = 14;
+        // How many times the device idling for deep Doze mode.
+        optional int32 deep_doze_idling_count = 15;
+        optional int64 longest_deep_doze_duration_ms = 16;
+        // Amount of time the device was in Doze Light.
+        optional int64 light_doze_enabled_duration_ms = 17;
+        // How many times the device went into Doze Light mode.
+        optional int32 light_doze_count = 18;
+        // Amount of time the device was idling in Doze Light. Idling time
+        // encompasses "doze" time and the maintenance windows that allow apps to
+        // operate.
+        optional int64 light_doze_idling_duration_ms = 19;
+        // How many times the device idling for Doze Light mode.
+        optional int32 light_doze_idling_count = 20;
+        optional int64 longest_light_doze_duration_ms = 21;
     }
-    // Doze mode for the entire battery level step. MIXED is used if there were
-    // multiple states for this step.
-    optional IdleMode idle_mode = 5;
-  };
-  // Battery level steps when the device was charging.
-  repeated BatteryLevelStep charge_step = 5;
-  // Battery level steps when the device was discharging.
-  repeated BatteryLevelStep discharge_step = 6;
+    optional Misc misc = 15;
 
-  // All CPU frequencies of the device.
-  repeated int64 cpu_frequency = 7;
+    message PhoneSignalStrength {
+        option (android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  message DataConnection {
-    option (android.msg_privacy).dest = DEST_AUTOMATIC;
-    oneof type {
-      android.telephony.NetworkTypeEnum name = 1;
-      // If is_none is not set, then the name is a valid network type.
-      bool is_none = 2;
+        optional android.telephony.SignalStrengthEnum name = 1;
+        optional TimerProto total = 2;
+    };
+    repeated PhoneSignalStrength phone_signal_strength = 16;
+
+    message PowerUseItem {
+        option (android.msg_privacy).dest = DEST_AUTOMATIC;
+
+        enum Sipper {
+            UNKNOWN_SIPPER = 0;
+            IDLE = 1;
+            CELL = 2;
+            PHONE = 3;
+            WIFI = 4;
+            BLUETOOTH = 5;
+            FLASHLIGHT = 6;
+            SCREEN = 7;
+            USER = 8;
+            UNACCOUNTED = 9;
+            OVERCOUNTED = 10;
+            CAMERA = 11;
+            MEMORY = 12;
+            AMBIENT_DISPLAY = 13;
+        };
+        optional Sipper name = 1;
+        // UID, only valid for the USER sipper.
+        optional int32 uid = 2;
+        // Estimated power use in mAh.
+        optional double computed_power_mah = 3;
+        // Starting in Oreo, Battery Settings has two modes to display the battery
+        // info. The first is "app usage list". In this mode, items with should_hide
+        // enabled are hidden.
+        optional bool should_hide = 4;
+        // Smeared power from screen usage. Screen usage power is split and smeared
+        // among apps, based on activity time.
+        optional double screen_power_mah = 5;
+        // Smeared power using proportional method. Power usage from hidden sippers
+        // is smeared to all apps proportionally (except for screen usage).
+        optional double proportional_smear_mah = 6;
+    };
+    repeated PowerUseItem power_use_item = 17;
+
+    message PowerUseSummary {
+        option (android.msg_privacy).dest = DEST_AUTOMATIC;
+
+        optional double battery_capacity_mah = 1;
+        optional double computed_power_mah = 2;
+        // Lower bound of actual power drained.
+        optional double min_drained_power_mah = 3;
+        // Upper bound of actual power drained.
+        optional double max_drained_power_mah = 4;
+    };
+    optional PowerUseSummary power_use_summary = 18;
+
+    message ResourcePowerManager {
+        option (android.msg_privacy).dest = DEST_AUTOMATIC;
+
+        // Either StateName or StateName.VoterName.
+        optional string name = 1;
+        optional TimerProto total = 2;
+        optional TimerProto screen_off = 3;
     }
-    optional TimerProto total = 3;
-  };
-  repeated DataConnection data_connection = 8;
+    repeated ResourcePowerManager resource_power_manager = 19;
 
-  optional ControllerActivityProto global_bluetooth_controller = 9;
-  optional ControllerActivityProto global_modem_controller = 10;
-  optional ControllerActivityProto global_wifi_controller = 11;
+    message ScreenBrightness {
+        option (android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  message GlobalNetwork {
-    option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
-    // Total Bytes received on mobile connections.
-    optional int64 mobile_bytes_rx = 1;
-    // Total Bytes transmitted on mobile connections.
-    optional int64 mobile_bytes_tx = 2;
-    // Total Bytes received on wifi connections.
-    optional int64 wifi_bytes_rx = 3;
-    // Total Bytes transmitted on wifi connections.
-    optional int64 wifi_bytes_tx = 4;
-    // Total Packets received on mobile connections.
-    optional int64 mobile_packets_rx = 5;
-    // Total Packets transmitted on mobile connections.
-    optional int64 mobile_packets_tx = 6;
-    // Total Packets received on wifi connections.
-    optional int64 wifi_packets_rx = 7;
-    // Total Packets transmitted on wifi connections.
-    optional int64 wifi_packets_tx = 8;
-    // Total Bytes received on bluetooth connections.
-    optional int64 bt_bytes_rx = 9;
-    // Total Bytes transmitted on bluetooth connections.
-    optional int64 bt_bytes_tx = 10;
-  };
-  optional GlobalNetwork global_network = 12;
-
-  message GlobalWifi {
-    option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
-    // The amount of time that wifi has been on while the device was running on
-    // battery.
-    optional int64 on_duration_ms = 1;
-    // The amount of time that wifi has been on and the driver has been in the
-    // running state while the device was running on battery.
-    optional int64 running_duration_ms = 2;
-  }
-  optional GlobalWifi global_wifi = 13;
-
-  // Kernel wakelock metrics are only recorded when the device is unplugged
-  // *and* the screen is off.
-  message KernelWakelock {
-    option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
-    optional string name = 1;
-    // Kernel wakelock stats aren't apportioned across all kernel wakelocks (as
-    // app wakelocks stats are).
-    optional TimerProto total = 2;
-    // The kernel doesn't have the data to enable printing out current and max
-    // durations.
-  };
-  repeated KernelWakelock kernel_wakelock = 14;
-
-  message Misc {
-    option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
-    optional int64 screen_on_duration_ms = 1;
-    optional int64 phone_on_duration_ms = 2;
-    optional int64 full_wakelock_total_duration_ms = 3;
-    // The total elapsed time that a partial wakelock was held. This duration
-    // does not double count wakelocks held at the same time.
-    optional int64 partial_wakelock_total_duration_ms = 4;
-    optional int64 mobile_radio_active_duration_ms = 5;
-    // The time that is the difference between the mobile radio time we saw
-    // based on the elapsed timestamp when going down vs. the given time stamp
-    // from the radio.
-    optional int64 mobile_radio_active_adjusted_time_ms = 6;
-    optional int32 mobile_radio_active_count = 7;
-    // The amount of time that the mobile network has been active (in a high
-    // power state) but not being able to blame on an app.
-    optional int32 mobile_radio_active_unknown_duration_ms = 8;
-    // Total amount of time the device was in the interactive state.
-    optional int64 interactive_duration_ms = 9;
-    optional int64 battery_saver_mode_enabled_duration_ms = 10;
-    optional int32 num_connectivity_changes = 11;
-    // Amount of time the device was in deep Doze.
-    optional int64 deep_doze_enabled_duration_ms = 12;
-    // How many times the device went into deep Doze mode.
-    optional int32 deep_doze_count = 13;
-    // Amount of time the device was idling in deep Doze. Idling time
-    // encompasses "doze" time and the maintenance windows that allow apps to
-    // operate.
-    optional int64 deep_doze_idling_duration_ms = 14;
-    // How many times the device idling for deep Doze mode.
-    optional int32 deep_doze_idling_count = 15;
-    optional int64 longest_deep_doze_duration_ms = 16;
-    // Amount of time the device was in Doze Light.
-    optional int64 light_doze_enabled_duration_ms = 17;
-    // How many times the device went into Doze Light mode.
-    optional int32 light_doze_count = 18;
-    // Amount of time the device was idling in Doze Light. Idling time
-    // encompasses "doze" time and the maintenance windows that allow apps to
-    // operate.
-    optional int64 light_doze_idling_duration_ms = 19;
-    // How many times the device idling for Doze Light mode.
-    optional int32 light_doze_idling_count = 20;
-    optional int64 longest_light_doze_duration_ms = 21;
-  }
-  optional Misc misc = 15;
-
-  message PhoneSignalStrength {
-    option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
-    optional android.telephony.SignalStrengthEnum name = 1;
-    optional TimerProto total = 2;
-  };
-  repeated PhoneSignalStrength phone_signal_strength = 16;
-
-  message PowerUseItem {
-    option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
-    enum Sipper {
-      UNKNOWN_SIPPER = 0;
-      IDLE = 1;
-      CELL = 2;
-      PHONE = 3;
-      WIFI = 4;
-      BLUETOOTH = 5;
-      FLASHLIGHT = 6;
-      SCREEN = 7;
-      USER = 8;
-      UNACCOUNTED = 9;
-      OVERCOUNTED = 10;
-      CAMERA = 11;
-      MEMORY = 12;
+        enum Name {
+            DARK = 0; // Not screen-off.
+            DIM = 1;
+            MEDIUM = 2;
+            LIGHT = 3;
+            BRIGHT = 4;
+        };
+        optional Name name = 1;
+        optional TimerProto total = 2;
     };
-    optional Sipper name = 1;
-    // UID, only valid for the USER sipper.
-    optional int32 uid = 2;
-    // Estimated power use in mAh.
-    optional double computed_power_mah = 3;
-    // Starting in Oreo, Battery Settings has two modes to display the battery
-    // info. The first is "app usage list". In this mode, items with should_hide
-    // enabled are hidden.
-    optional bool should_hide = 4;
-    // Smeared power from screen usage. Screen usage power is split and smeared
-    // among apps, based on activity time.
-    optional double screen_power_mah = 5;
-    // Smeared power using proportional method. Power usage from hidden sippers
-    // is smeared to all apps proportionally (except for screen usage).
-    optional double proportional_smear_mah = 6;
-  };
-  repeated PowerUseItem power_use_item = 17;
+    repeated ScreenBrightness screen_brightness = 20;
 
-  message PowerUseSummary {
-    option (android.msg_privacy).dest = DEST_AUTOMATIC;
+    // Duration and number of times trying to acquire a signal
+    optional TimerProto signal_scanning = 21;
 
-    optional double battery_capacity_mah = 1;
-    optional double computed_power_mah = 2;
-    // Lower bound of actual power drained.
-    optional double min_drained_power_mah = 3;
-    // Upper bound of actual power drained.
-    optional double max_drained_power_mah = 4;
-  };
-  optional PowerUseSummary power_use_summary = 18;
+    message WakeupReason {
+        option (android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  message ResourcePowerManager {
-    option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
-    // Either StateName or StateName.VoterName.
-    optional string name = 1;
-    optional TimerProto total = 2;
-    optional TimerProto screen_off = 3;
-  }
-  repeated ResourcePowerManager resource_power_manager = 19;
-
-  message ScreenBrightness {
-    option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
-    enum Name {
-      DARK = 0; // Not screen-off.
-      DIM = 1;
-      MEDIUM = 2;
-      LIGHT = 3;
-      BRIGHT = 4;
+        optional string name = 1;
+        optional TimerProto total = 2;
     };
-    optional Name name = 1;
-    optional TimerProto total = 2;
-  };
-  repeated ScreenBrightness screen_brightness = 20;
+    repeated WakeupReason wakeup_reason = 22;
 
-  // Duration and number of times trying to acquire a signal
-  optional TimerProto signal_scanning = 21;
+    message WifiMulticastWakelockTotal {
+        option (android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  message WakeupReason {
-    option (android.msg_privacy).dest = DEST_AUTOMATIC;
+        optional int64 duration_ms = 1;
+        optional int32 count = 2;
+    }
+    optional WifiMulticastWakelockTotal wifi_multicast_wakelock_total = 23;
 
-    optional string name = 1;
-    optional TimerProto total = 2;
-  };
-  repeated WakeupReason wakeup_reason = 22;
+    message WifiSignalStrength {
+        option (android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  message WifiMulticastWakelockTotal {
-    option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
-    optional int64 duration_ms = 1;
-    optional int32 count = 2;
-  }
-  optional WifiMulticastWakelockTotal wifi_multicast_wakelock_total = 23;
-
-  message WifiSignalStrength {
-    option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
-    enum Name {
-      NONE = 0;
-      POOR = 1;
-      MODERATE = 2;
-      GOOD = 3;
-      GREAT = 4;
+        enum Name {
+            NONE = 0;
+            POOR = 1;
+            MODERATE = 2;
+            GOOD = 3;
+            GREAT = 4;
+        };
+        optional Name name = 1;
+        optional TimerProto total = 2;
     };
-    optional Name name = 1;
-    optional TimerProto total = 2;
-  };
-  repeated WifiSignalStrength wifi_signal_strength = 24;
+    repeated WifiSignalStrength wifi_signal_strength = 24;
 
-  message WifiState {
-    option (android.msg_privacy).dest = DEST_AUTOMATIC;
+    message WifiState {
+        option (android.msg_privacy).dest = DEST_AUTOMATIC;
 
-    enum Name {
-      OFF = 0;
-      OFF_SCANNING = 1;
-      ON_NO_NETWORKS = 2;
-      ON_DISCONNECTED = 3;
-      ON_CONNECTED_STA = 4;
-      ON_CONNECTED_P2P = 5;
-      ON_CONNECTED_STA_P2P = 6;
-      SOFT_AP = 7;
+        enum Name {
+            OFF = 0;
+            OFF_SCANNING = 1;
+            ON_NO_NETWORKS = 2;
+            ON_DISCONNECTED = 3;
+            ON_CONNECTED_STA = 4;
+            ON_CONNECTED_P2P = 5;
+            ON_CONNECTED_STA_P2P = 6;
+            SOFT_AP = 7;
+        };
+        optional Name name = 1;
+        optional TimerProto total = 2;
     };
-    optional Name name = 1;
-    optional TimerProto total = 2;
-  };
-  repeated WifiState wifi_state = 25;
+    repeated WifiState wifi_state = 25;
 
-  message WifiSupplicantState {
-    option (android.msg_privacy).dest = DEST_AUTOMATIC;
+    message WifiSupplicantState {
+        option (android.msg_privacy).dest = DEST_AUTOMATIC;
 
-    enum Name {
-      INVALID = 0;
-      DISCONNECTED = 1;
-      INTERFACE_DISABLED = 2;
-      INACTIVE = 3;
-      SCANNING = 4;
-      AUTHENTICATING = 5;
-      ASSOCIATING = 6;
-      ASSOCIATED = 7;
-      FOUR_WAY_HANDSHAKE = 8;
-      GROUP_HANDSHAKE = 9;
-      COMPLETED = 10;
-      DORMANT = 11;
-      UNINITIALIZED = 12;
+        enum Name {
+            INVALID = 0;
+            DISCONNECTED = 1;
+            INTERFACE_DISABLED = 2;
+            INACTIVE = 3;
+            SCANNING = 4;
+            AUTHENTICATING = 5;
+            ASSOCIATING = 6;
+            ASSOCIATED = 7;
+            FOUR_WAY_HANDSHAKE = 8;
+            GROUP_HANDSHAKE = 9;
+            COMPLETED = 10;
+            DORMANT = 11;
+            UNINITIALIZED = 12;
+        };
+        optional Name name = 1;
+        optional TimerProto total = 2;
     };
-    optional Name name = 1;
-    optional TimerProto total = 2;
-  };
-  repeated WifiSupplicantState wifi_supplicant_state = 26;
+    repeated WifiSupplicantState wifi_supplicant_state = 26;
 }
 
 message TimerProto {
-  option (android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  // This may be an apportioned time.
-  optional int64 duration_ms = 1;
-  optional int64 count = 2;
-  // The max duration if it is being tracked. Not all Timer subclasses
-  // track the max duration.
-  optional int64 max_duration_ms = 3;
-  // The current time the timer has been active, if it is being tracked.
-  // Not all Timer subclasses track the current duration.
-  optional int64 current_duration_ms = 4;
-  // The total cumulative duration (i.e. sum of past durations) that this timer
-  // has been on since reset. This may differ from duration_ms since, depending
-  // on the Timer, getTotalTimeLocked may represent the total 'blamed' or
-  // 'pooled' time, rather than the actual time. By contrast, total_duration_ms
-  // always gives the actual total time. Not all Timer subclasses track the
-  // total duration.
-  optional int64 total_duration_ms = 5;
+    // This may be an apportioned time.
+    optional int64 duration_ms = 1;
+    optional int64 count = 2;
+    // The max duration if it is being tracked. Not all Timer subclasses
+    // track the max duration.
+    optional int64 max_duration_ms = 3;
+    // The current time the timer has been active, if it is being tracked.
+    // Not all Timer subclasses track the current duration.
+    optional int64 current_duration_ms = 4;
+    // The total cumulative duration (i.e. sum of past durations) that this timer
+    // has been on since reset. This may differ from duration_ms since, depending
+    // on the Timer, getTotalTimeLocked may represent the total 'blamed' or
+    // 'pooled' time, rather than the actual time. By contrast, total_duration_ms
+    // always gives the actual total time. Not all Timer subclasses track the
+    // total duration.
+    optional int64 total_duration_ms = 5;
 }
 
 message UidProto {
-  option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
-  // Combination of app ID and user ID.
-  optional int32 uid = 1;
-
-  // The statistics associated with a particular package.
-  message Package {
     option (android.msg_privacy).dest = DEST_AUTOMATIC;
 
-    optional string name = 1;
+    // Combination of app ID and user ID.
+    optional int32 uid = 1;
 
-    message Service {
-      option (android.msg_privacy).dest = DEST_AUTOMATIC;
+    // The statistics associated with a particular package.
+    message Package {
+        option (android.msg_privacy).dest = DEST_AUTOMATIC;
 
-      optional string name = 1;
-      // Time spent started.
-      optional int64 start_duration_ms = 2;
-      optional int32 start_count = 3;
-      optional int32 launch_count = 4;
+        optional string name = 1;
+
+        message Service {
+            option (android.msg_privacy).dest = DEST_AUTOMATIC;
+
+            optional string name = 1;
+            // Time spent started.
+            optional int64 start_duration_ms = 2;
+            optional int32 start_count = 3;
+            optional int32 launch_count = 4;
+        }
+        repeated Service services = 2;
     }
-    repeated Service services = 2;
-  }
-  repeated Package packages = 2;
+    repeated Package packages = 2;
 
-  optional ControllerActivityProto bluetooth_controller = 3;
-  optional ControllerActivityProto modem_controller = 4;
-  optional ControllerActivityProto wifi_controller = 5;
+    optional ControllerActivityProto bluetooth_controller = 3;
+    optional ControllerActivityProto modem_controller = 4;
+    optional ControllerActivityProto wifi_controller = 5;
 
-  // Bluetooth misc data.
-  message BluetoothMisc {
-    option (android.msg_privacy).dest = DEST_AUTOMATIC;
+    // Bluetooth misc data.
+    message BluetoothMisc {
+        option (android.msg_privacy).dest = DEST_AUTOMATIC;
 
-    // Duration spent BLE scanning blamed on this App (i.e. apportioned to this
-    // app amongst all apps doing BLE scanning; see explanation of 'apportioned'
-    // in App's comment).
-    optional TimerProto apportioned_ble_scan = 1;
-    // Background times aren't apportioned.
-    optional TimerProto background_ble_scan = 2;
-    // Running unoptimized BLE scanning, as defined by Bluetooth's
-    // AppScanStats.recordScanStart. As of May 2017, these are unfiltered,
-    // non-opportunistic, non-first-match scans. Durations are not
-    // pooled/apportioned.
-    optional TimerProto unoptimized_ble_scan = 3;
-    // Running unoptimized BLE scanning when app is in background. Durations are
-    // not pooled/apportioned.
-    optional TimerProto background_unoptimized_ble_scan = 4;
-    // Count of results returned by BLE scanning.
-    optional int32 ble_scan_result_count = 5;
-    // Count of results returned by BLE scans when app is in background.
-    // (Included in ble_scan_result_count.)
-    optional int32 background_ble_scan_result_count = 6;
-  }
-  optional BluetoothMisc bluetooth_misc = 6;
-
-  message Cpu {
-    option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
-    // Total CPU time with processes executing in userspace. Summed up across
-    // multiple cores.
-    optional int64 user_duration_ms = 1;
-    // Total CPU time with processes executing kernel syscalls. Summed up across
-    // multiple cores.
-    optional int64 system_duration_ms = 2;
-
-    // CPU time broken down by CPU frequency (go/cpu-battery-metrics).
-    //
-    // These are real CPU time measurement from the kernel, so their sum can
-    // be different from the sum of user_duration_millis and
-    // system_duration_millis, which are just approximations. Data is not
-    // tracked when device is charging.
-    message ByFrequency {
-      option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
-      // Index of the frequency in system.cpu_frequency. It starts from 1, to
-      // make it easier to analyze.
-      optional int32 frequency_index = 1;
-      // CPU time in milliseconds.
-      optional int64 total_duration_ms = 2;
-      // Screen-off CPU time in milliseconds.
-      optional int64 screen_off_duration_ms = 3;
+        // Duration spent BLE scanning blamed on this App (i.e. apportioned to this
+        // app amongst all apps doing BLE scanning; see explanation of 'apportioned'
+        // in App's comment).
+        optional TimerProto apportioned_ble_scan = 1;
+        // Background times aren't apportioned.
+        optional TimerProto background_ble_scan = 2;
+        // Running unoptimized BLE scanning, as defined by Bluetooth's
+        // AppScanStats.recordScanStart. As of May 2017, these are unfiltered,
+        // non-opportunistic, non-first-match scans. Durations are not
+        // pooled/apportioned.
+        optional TimerProto unoptimized_ble_scan = 3;
+        // Running unoptimized BLE scanning when app is in background. Durations are
+        // not pooled/apportioned.
+        optional TimerProto background_unoptimized_ble_scan = 4;
+        // Count of results returned by BLE scanning.
+        optional int32 ble_scan_result_count = 5;
+        // Count of results returned by BLE scans when app is in background.
+        // (Included in ble_scan_result_count.)
+        optional int32 background_ble_scan_result_count = 6;
     }
-    // CPU times accumulated across all process states.
-    repeated ByFrequency by_frequency = 3;
+    optional BluetoothMisc bluetooth_misc = 6;
 
-    enum ProcessState {
-      TOP = 0;
-      FOREGROUND_SERVICE = 1;
-      FOREGROUND = 2;
-      BACKGROUND = 3;
-      TOP_SLEEPING = 4;
-      HEAVY_WEIGHT = 5;
-      CACHED = 6;
+    message Cpu {
+        option (android.msg_privacy).dest = DEST_AUTOMATIC;
+
+        // Total CPU time with processes executing in userspace. Summed up across
+        // multiple cores.
+        optional int64 user_duration_ms = 1;
+        // Total CPU time with processes executing kernel syscalls. Summed up across
+        // multiple cores.
+        optional int64 system_duration_ms = 2;
+
+        // CPU time broken down by CPU frequency (go/cpu-battery-metrics).
+        //
+        // These are real CPU time measurement from the kernel, so their sum can
+        // be different from the sum of user_duration_millis and
+        // system_duration_millis, which are just approximations. Data is not
+        // tracked when device is charging.
+        message ByFrequency {
+            option (android.msg_privacy).dest = DEST_AUTOMATIC;
+
+            // Index of the frequency in system.cpu_frequency. It starts from 1, to
+            // make it easier to analyze.
+            optional int32 frequency_index = 1;
+            // CPU time in milliseconds.
+            optional int64 total_duration_ms = 2;
+            // Screen-off CPU time in milliseconds.
+            optional int64 screen_off_duration_ms = 3;
+        }
+        // CPU times accumulated across all process states.
+        repeated ByFrequency by_frequency = 3;
+
+        enum ProcessState {
+            TOP = 0;
+            FOREGROUND_SERVICE = 1;
+            FOREGROUND = 2;
+            BACKGROUND = 3;
+            TOP_SLEEPING = 4;
+            HEAVY_WEIGHT = 5;
+            CACHED = 6;
+        }
+        // CPU times at different process states.
+        message ByProcessState {
+            option (android.msg_privacy).dest = DEST_AUTOMATIC;
+
+            optional ProcessState process_state = 1;
+            repeated ByFrequency by_frequency = 2;
+        }
+        repeated ByProcessState by_process_state = 4;
     }
-    // CPU times at different process states.
-    message ByProcessState {
-      option (android.msg_privacy).dest = DEST_AUTOMATIC;
+    optional Cpu cpu = 7;
 
-      optional ProcessState process_state = 1;
-      repeated ByFrequency by_frequency = 2;
+    // Duration is pooled/apportioned.
+    optional TimerProto audio = 8;
+    // Duration is pooled/apportioned.
+    optional TimerProto camera = 9;
+    // Duration is pooled/apportioned.
+    optional TimerProto flashlight = 10;
+    // Duration is not pooled/apportioned.
+    optional TimerProto foreground_activity = 11;
+    // Duration is not pooled/apportioned.
+    optional TimerProto foreground_service = 12;
+    // Duration is not pooled/apportioned.
+    optional TimerProto vibrator = 13;
+    // Duration is pooled/apportioned.
+    optional TimerProto video = 14;
+
+    message Job {
+        option (android.msg_privacy).dest = DEST_AUTOMATIC;
+
+        optional string name = 1;
+        // Job times aren't apportioned.
+        optional TimerProto total = 2;
+        optional TimerProto background = 3;
     }
-    repeated ByProcessState by_process_state = 4;
-  }
-  optional Cpu cpu = 7;
+    repeated Job jobs = 15;
 
-  // Duration is pooled/apportioned.
-  optional TimerProto audio = 8;
-  // Duration is pooled/apportioned.
-  optional TimerProto camera = 9;
-  // Duration is pooled/apportioned.
-  optional TimerProto flashlight = 10;
-  // Duration is not pooled/apportioned.
-  optional TimerProto foreground_activity = 11;
-  // Duration is not pooled/apportioned.
-  optional TimerProto foreground_service = 12;
-  // Duration is not pooled/apportioned.
-  optional TimerProto vibrator = 13;
-  // Duration is pooled/apportioned.
-  optional TimerProto video = 14;
+    message JobCompletion {
+        option (android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  message Job {
-    option (android.msg_privacy).dest = DEST_AUTOMATIC;
+        // Job name.
+        optional string name = 1;
 
-    optional string name = 1;
-    // Job times aren't apportioned.
-    optional TimerProto total = 2;
-    optional TimerProto background = 3;
-  }
-  repeated Job jobs = 15;
+        message ReasonCount {
+            option (android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  message JobCompletion {
-    option (android.msg_privacy).dest = DEST_AUTOMATIC;
+            optional android.app.job.StopReasonEnum name = 1;
+            optional int32 count = 2;
+        }
+        repeated ReasonCount reason_count = 2;
+    };
+    repeated JobCompletion job_completion = 16;
 
-    // Job name.
-    optional string name = 1;
+    message Network {
+        option (android.msg_privacy).dest = DEST_AUTOMATIC;
 
-    message ReasonCount {
-      option (android.msg_privacy).dest = DEST_AUTOMATIC;
+        // Mobile data traffic (total, background + foreground).
+        optional int64 mobile_bytes_rx = 1;
+        optional int64 mobile_bytes_tx = 2;
+        // Wifi data traffic (total, background + foreground).
+        optional int64 wifi_bytes_rx = 3;
+        optional int64 wifi_bytes_tx = 4;
+        // Bluetooth data traffic (total, background + foreground).
+        optional int64 bt_bytes_rx = 5;
+        optional int64 bt_bytes_tx = 6;
+        // In packets (total, background + foreground).
+        optional int64 mobile_packets_rx = 7;
+        optional int64 mobile_packets_tx = 8;
+        optional int64 wifi_packets_rx = 9;
+        optional int64 wifi_packets_tx = 10;
+        // Radio active duration.
+        optional int64 mobile_active_duration_ms = 11;
+        optional int32 mobile_active_count = 12;
+        // Number of times the app woke up the mobile radio.
+        optional int32 mobile_wakeup_count = 13;
+        // Number of times the app woke up the wifi radio.
+        optional int32 wifi_wakeup_count = 14;
+        // Mobile data traffic in the background only, included in total above.
+        optional int64 mobile_bytes_bg_rx = 15;
+        optional int64 mobile_bytes_bg_tx = 16;
+        // Wifi data traffic in the background only, included in total above.
+        optional int64 wifi_bytes_bg_rx = 17;
+        optional int64 wifi_bytes_bg_tx = 18;
+        // In packets (background only, included in total packets above).
+        optional int64 mobile_packets_bg_rx = 19;
+        optional int64 mobile_packets_bg_tx = 20;
+        optional int64 wifi_packets_bg_rx = 21;
+        optional int64 wifi_packets_bg_tx = 22;
+    };
+    optional Network network = 17;
 
-      optional android.app.job.StopReasonEnum name = 1;
-      optional int32 count = 2;
+    // TODO: combine System and App messages?
+    message PowerUseItem {
+        option (android.msg_privacy).dest = DEST_AUTOMATIC;
+
+        // Estimated power use in mAh.
+        optional double computed_power_mah = 1;
+        // Starting in Oreo, Battery Settings has two modes to display the battery
+        // info. The first is "app usage list". In this mode, items with should_hide
+        // enabled are hidden.
+        optional bool should_hide = 2;
+        // Smeared power from screen usage. Screen usage power is split and smeared
+        // among apps, based on activity time.
+        optional double screen_power_mah = 3;
+        // Smeared power using proportional method. Power usage from hidden sippers
+        // is smeared to all apps proportionally (except for screen usage).
+        optional double proportional_smear_mah = 4;
+    };
+    optional PowerUseItem power_use_item = 18;
+
+    // Durations are not pooled/apportioned.
+    message Process {
+        option (android.msg_privacy).dest = DEST_AUTOMATIC;
+
+        optional string name = 1;
+        // Time spent executing in user code.
+        optional int64 user_duration_ms = 2;
+        // Time spent executing in kernel code.
+        optional int64 system_duration_ms = 3;
+        // Time the process was running in the foreground.
+        optional int64 foreground_duration_ms = 4;
+        // Number of times the process has been started.
+        optional int32 start_count = 5;
+        // Number of times the process has had an ANR.
+        optional int32 anr_count = 6;
+        // Number of times the process has crashed.
+        optional int32 crash_count = 7;
+    };
+    repeated Process process = 19;
+
+    message StateTime {
+        option (android.msg_privacy).dest = DEST_AUTOMATIC;
+
+        // All of these (non-deprecated) states are mutually exclusive and can be
+        // added together to find the total time a uid has had any processes running
+        // at all.
+
+        // In approximate order or priority (top being what the framework considers
+        // most important and is thus least likely to kill when resources are
+        // needed:
+        // top > foreground service > foreground > background > top sleeping > heavy weight > cache
+        enum State {
+            // Time this uid has any processes in the top state.
+            PROCESS_STATE_TOP = 0;
+            // Time this uid has any process with a started foreground service, but
+            // none in the "top" state.
+            PROCESS_STATE_FOREGROUND_SERVICE = 1;
+            // Time this uid has any process in an active foreground state, but none in the
+            // "foreground service" or better state. Persistent and other foreground states go here.
+            PROCESS_STATE_FOREGROUND = 2;
+            // Time this uid has any process in an active background state, but none
+            // in the "foreground" or better state.
+            PROCESS_STATE_BACKGROUND = 3;
+            // Time this uid has any process that is top while the device is sleeping,
+            // but not active for any other reason. We consider is a kind of cached
+            // process for execution restrictions. Sleeping is mostly screen off, but
+            // also includes the time when the screen is on but the device has not yet
+            // been unlocked.
+            PROCESS_STATE_TOP_SLEEPING = 4;
+            // Time this uid has any process that is in the background but it has an
+            // activity marked as "can't save state". This is essentially a cached
+            // process, though the system will try much harder than normal to avoid
+            // killing it.
+            PROCESS_STATE_HEAVY_WEIGHT = 5;
+            // Time this uid has any processes that are sitting around cached, not in
+            // one of the other active states.
+            PROCESS_STATE_CACHED = 6;
+        }
+        optional State state = 1;
+        optional int64 duration_ms = 2;
     }
-    repeated ReasonCount reason_count = 2;
-  };
-  repeated JobCompletion job_completion = 16;
+    repeated StateTime states = 20;
 
-  message Network {
-    option (android.msg_privacy).dest = DEST_AUTOMATIC;
+    message Sensor {
+        option (android.msg_privacy).dest = DEST_AUTOMATIC;
 
-    // Mobile data traffic (total, background + foreground).
-    optional int64 mobile_bytes_rx = 1;
-    optional int64 mobile_bytes_tx = 2;
-    // Wifi data traffic (total, background + foreground).
-    optional int64 wifi_bytes_rx = 3;
-    optional int64 wifi_bytes_tx = 4;
-    // Bluetooth data traffic (total, background + foreground).
-    optional int64 bt_bytes_rx = 5;
-    optional int64 bt_bytes_tx = 6;
-    // In packets (total, background + foreground).
-    optional int64 mobile_packets_rx = 7;
-    optional int64 mobile_packets_tx = 8;
-    optional int64 wifi_packets_rx = 9;
-    optional int64 wifi_packets_tx = 10;
-    // Radio active duration.
-    optional int64 mobile_active_duration_ms = 11;
-    optional int32 mobile_active_count = 12;
-    // Number of times the app woke up the mobile radio.
-    optional int32 mobile_wakeup_count = 13;
-    // Number of times the app woke up the wifi radio.
-    optional int32 wifi_wakeup_count = 14;
-    // Mobile data traffic in the background only, included in total above.
-    optional int64 mobile_bytes_bg_rx = 15;
-    optional int64 mobile_bytes_bg_tx = 16;
-    // Wifi data traffic in the background only, included in total above.
-    optional int64 wifi_bytes_bg_rx = 17;
-    optional int64 wifi_bytes_bg_tx = 18;
-    // In packets (background only, included in total packets above).
-    optional int64 mobile_packets_bg_rx = 19;
-    optional int64 mobile_packets_bg_tx = 20;
-    optional int64 wifi_packets_bg_rx = 21;
-    optional int64 wifi_packets_bg_tx = 22;
-  };
-  optional Network network = 17;
-
-  // TODO: combine System and App messages?
-  message PowerUseItem {
-    option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
-    // Estimated power use in mAh.
-    optional double computed_power_mah = 1;
-    // Starting in Oreo, Battery Settings has two modes to display the battery
-    // info. The first is "app usage list". In this mode, items with should_hide
-    // enabled are hidden.
-    optional bool should_hide = 2;
-    // Smeared power from screen usage. Screen usage power is split and smeared
-    // among apps, based on activity time.
-    optional double screen_power_mah = 3;
-    // Smeared power using proportional method. Power usage from hidden sippers
-    // is smeared to all apps proportionally (except for screen usage).
-    optional double proportional_smear_mah = 4;
-  };
-  optional PowerUseItem power_use_item = 18;
-
-  // Durations are not pooled/apportioned.
-  message Process {
-    option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
-    optional string name = 1;
-    // Time spent executing in user code.
-    optional int64 user_duration_ms = 2;
-    // Time spent executing in kernel code.
-    optional int64 system_duration_ms = 3;
-    // Time the process was running in the foreground.
-    optional int64 foreground_duration_ms = 4;
-    // Number of times the process has been started.
-    optional int32 start_count = 5;
-    // Number of times the process has had an ANR.
-    optional int32 anr_count = 6;
-    // Number of times the process has crashed.
-    optional int32 crash_count = 7;
-  };
-  repeated Process process = 19;
-
-  message StateTime {
-    option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
-    // All of these (non-deprecated) states are mutually exclusive and can be
-    // added together to find the total time a uid has had any processes running
-    // at all.
-
-    // In approximate order or priority (top being what the framework considers
-    // most important and is thus least likely to kill when resources are
-    // needed:
-    // top > foreground service > foreground > background > top sleeping > heavy weight > cache
-    enum State {
-      // Time this uid has any processes in the top state.
-      PROCESS_STATE_TOP = 0;
-      // Time this uid has any process with a started foreground service, but
-      // none in the "top" state.
-      PROCESS_STATE_FOREGROUND_SERVICE = 1;
-      // Time this uid has any process in an active foreground state, but none in the
-      // "foreground service" or better state. Persistent and other foreground states go here.
-      PROCESS_STATE_FOREGROUND = 2;
-      // Time this uid has any process in an active background state, but none
-      // in the "foreground" or better state.
-      PROCESS_STATE_BACKGROUND = 3;
-      // Time this uid has any process that is top while the device is sleeping,
-      // but not active for any other reason. We consider is a kind of cached
-      // process for execution restrictions. Sleeping is mostly screen off, but
-      // also includes the time when the screen is on but the device has not yet
-      // been unlocked.
-      PROCESS_STATE_TOP_SLEEPING = 4;
-      // Time this uid has any process that is in the background but it has an
-      // activity marked as "can't save state".  This is essentially a cached
-      // process, though the system will try much harder than normal to avoid
-      // killing it.
-      PROCESS_STATE_HEAVY_WEIGHT = 5;
-      // Time this uid has any processes that are sitting around cached, not in
-      // one of the other active states.
-      PROCESS_STATE_CACHED = 6;
+        optional int32 id = 1;
+        optional TimerProto apportioned = 2;
+        // Background times aren't apportioned.
+        optional TimerProto background = 3;
     }
-    optional State state = 1;
-    optional int64 duration_ms = 2;
-  }
-  repeated StateTime states = 20;
+    repeated Sensor sensors = 21;
 
-  message Sensor {
-    option (android.msg_privacy).dest = DEST_AUTOMATIC;
+    message Sync {
+        option (android.msg_privacy).dest = DEST_AUTOMATIC;
 
-    optional int32 id = 1;
-    optional TimerProto apportioned = 2;
-    // Background times aren't apportioned.
-    optional TimerProto background = 3;
-  }
-  repeated Sensor sensors = 21;
+        optional string name = 1;
+        // Sync times aren't apportioned.
+        optional TimerProto total = 2;
+        optional TimerProto background = 3;
+    }
+    repeated Sync syncs = 22;
 
-  message Sync {
-    option (android.msg_privacy).dest = DEST_AUTOMATIC;
+    message UserActivity {
+        option (android.msg_privacy).dest = DEST_AUTOMATIC;
 
-    optional string name = 1;
-    // Sync times aren't apportioned.
-    optional TimerProto total = 2;
-    optional TimerProto background = 3;
-  }
-  repeated Sync syncs = 22;
+        optional android.os.PowerManagerProto.UserActivityEvent name = 1;
+        optional int32 count = 2;
+    };
+    repeated UserActivity user_activity = 23;
 
-  message UserActivity {
-    option (android.msg_privacy).dest = DEST_AUTOMATIC;
+    // Aggregated wakelock data for an app overall, across all of its wakelocks.
+    // The Wakelock message holds data about each *individual* wakelock, but it
+    // cannot be used to ascertain the aggregated time the app spent holding
+    // wakelocks, since merely summing Wakelock data will either underestimate (in
+    // the case of wakelock.partial.duration_ms) or overestimate (in the case of
+    // wakelock.partial.total_duration_ms) the total time, due to overlapping
+    // wakelocks. AggregatedWakelock, on the other hand, holds overall per-app
+    // wakelock data.
+    message AggregatedWakelock {
+        option (android.msg_privacy).dest = DEST_AUTOMATIC;
 
-    optional android.os.PowerManagerProto.UserActivityEvent name = 1;
-    optional int32 count = 2;
-  };
-  repeated UserActivity user_activity = 23;
+        // The total duration that the app spent holding partial wakelocks.
+        // It includes both foreground + background use.
+        optional int64 partial_duration_ms = 1;
+        // The total duration that the app spent holding partial wakelocks while the
+        // app was in the background. Subtracting from partial_duration_ms will
+        // yield foreground usage.
+        optional int64 background_partial_duration_ms = 2;
+    };
+    optional AggregatedWakelock aggregated_wakelock = 24;
 
-  // Aggregated wakelock data for an app overall, across all of its wakelocks.
-  // The Wakelock message holds data about each *individual* wakelock, but it
-  // cannot be used to ascertain the aggregated time the app spent holding
-  // wakelocks, since merely summing Wakelock data will either underestimate (in
-  // the case of wakelock.partial.duration_ms) or overestimate (in the case of
-  // wakelock.partial.total_duration_ms) the total time, due to overlapping
-  // wakelocks. AggregatedWakelock, on the other hand, holds overall per-app
-  // wakelock data.
-  message AggregatedWakelock {
-    option (android.msg_privacy).dest = DEST_AUTOMATIC;
+    message Wakelock {
+        option (android.msg_privacy).dest = DEST_AUTOMATIC;
 
-    // The total duration that the app spent holding partial wakelocks.
-    // It includes both foreground + background use.
-    optional int64 partial_duration_ms = 1;
-    // The total duration that the app spent holding partial wakelocks while the
-    // app was in the background. Subtracting from partial_duration_ms will
-    // yield foreground usage.
-    optional int64 background_partial_duration_ms = 2;
-  };
-  optional AggregatedWakelock aggregated_wakelock = 24;
+        optional string name = 1;
 
-  message Wakelock {
-    option (android.msg_privacy).dest = DEST_AUTOMATIC;
+        // Full wakelocks keep the screen on. Based on
+        // PowerManager.SCREEN_BRIGHT_WAKE_LOCK (deprecated in API 13) and
+        // PowerManager.SCREEN_DIM_WAKE_LOCK (deprecated in API 17). Current, max,
+        // and total durations are not tracked for full wakelocks.
+        optional TimerProto full = 2;
 
-    optional string name = 1;
+        // Partial wakelocks ensure the CPU is running while allowing the screen
+        // to turn off. Based on PowerManager.PARTIAL_WAKE_LOCK.
+        // Partial wakelock metrics are only recorded when the device is unplugged
+        // *and* the screen is off. Current, max, and total durations are tracked
+        // for partial wakelocks.
+        optional TimerProto partial = 3;
 
-    // Full wakelocks keep the screen on. Based on
-    // PowerManager.SCREEN_BRIGHT_WAKE_LOCK (deprecated in API 13) and
-    // PowerManager.SCREEN_DIM_WAKE_LOCK (deprecated in API 17). Current, max,
-    // and total durations are not tracked for full wakelocks.
-    optional TimerProto full = 2;
+        // These fields are for tracking partial wakelocks (see above), but only
+        // the time the wakelock was held while the app was in a background state.
+        // Since all background tracking is 'actual', not 'apportioned',
+        // background_partial.duration_ms is identical to
+        // background_partial.total_duration_ms.
+        optional TimerProto background_partial = 4;
 
-    // Partial wakelocks ensure the CPU is running while allowing the screen
-    // to turn off. Based on PowerManager.PARTIAL_WAKE_LOCK.
-    // Partial wakelock metrics are only recorded when the device is unplugged
-    // *and* the screen is off. Current, max, and total durations are tracked
-    // for partial wakelocks.
-    optional TimerProto partial = 3;
+        // Window wakelocks keep the screen on. Current, max, and total durations
+        // are not tracked for window wakelocks.
+        optional TimerProto window = 5;
+    };
+    repeated Wakelock wakelocks = 25;
 
-    // These fields are for tracking partial wakelocks (see above), but only
-    // the time the wakelock was held while the app was in a background state.
-    // Since all background tracking is 'actual', not 'apportioned',
-    // background_partial.duration_ms is identical to
-    // background_partial.total_duration_ms.
-    optional TimerProto background_partial = 4;
+    message WakeupAlarm {
+        option (android.msg_privacy).dest = DEST_AUTOMATIC;
 
-    // Window wakelocks keep the screen on. Current, max, and total durations
-    // are not tracked for window wakelocks.
-    optional TimerProto window = 5;
-  };
-  repeated Wakelock wakelocks = 25;
+        // Wakeup alarm name.
+        optional string name = 1;
+        // Only includes counts when screen-off (& on battery).
+        optional int32 count = 2;
+    }
+    repeated WakeupAlarm wakeup_alarm = 26;
 
-  message WakeupAlarm {
-    option (android.msg_privacy).dest = DEST_AUTOMATIC;
+    message Wifi {
+        option (android.msg_privacy).dest = DEST_AUTOMATIC;
 
-    // Wakeup alarm name.
-    optional string name = 1;
-    // Only includes counts when screen-off (& on battery).
-    optional int32 count = 2;
-  }
-  repeated WakeupAlarm wakeup_alarm = 26;
+        // Duration holding Wifi-lock. This time is apportioned.
+        optional int64 full_wifi_lock_duration_ms = 1;
+        // Duration running Wifi. This time is apportioned.
+        optional int64 running_duration_ms = 2;
+        // Duration performing Wifi-scan blamed on this App (i.e. apportioned to
+        // this app amongst all apps doing Wifi-scanning; see explanation of
+        // 'apportioned' in App's comment).
+        optional TimerProto apportioned_scan = 3;
+        // Scans performed when app is in background. (Included in
+        // apportioned_scan). This value is not apportioned. Subtracting
+        // background_scan.total_duration_ms from apportioned_scan.total_duration_ms
+        // will yield foreground usage.
+        optional TimerProto background_scan = 4;
+    };
+    optional Wifi wifi = 27;
 
-  message Wifi {
-    option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
-    // Duration holding Wifi-lock. This time is apportioned.
-    optional int64 full_wifi_lock_duration_ms = 1;
-    // Duration running Wifi. This time is apportioned.
-    optional int64 running_duration_ms = 2;
-    // Duration performing Wifi-scan blamed on this App (i.e. apportioned to
-    // this app amongst all apps doing Wifi-scanning; see explanation of
-    // 'apportioned' in App's comment).
-    optional TimerProto apportioned_scan = 3;
-    // Scans performed when app is in background. (Included in
-    // apportioned_scan). This value is not apportioned. Subtracting
-    // background_scan.total_duration_ms from apportioned_scan.total_duration_ms
-    // will yield foreground usage.
-    optional TimerProto background_scan = 4;
-  };
-  optional Wifi wifi = 27;
-
-  // WiFi Multicast Wakelock
-  // This timer tracks the duration and count for the app to request the
-  // wakelock for wifi multicast traffic.
-  // This wakelock disables the filtering of multicast packets to reach the host
-  // processor, and results in a power penalty.
-  // It is useful to monitor the applications resulting in that
-  optional TimerProto wifi_multicast_wakelock = 28;
+    // WiFi Multicast Wakelock
+    // This timer tracks the duration and count for the app to request the
+    // wakelock for wifi multicast traffic.
+    // This wakelock disables the filtering of multicast packets to reach the host
+    // processor, and results in a power penalty.
+    // It is useful to monitor the applications resulting in that
+    optional TimerProto wifi_multicast_wakelock = 28;
 }
diff --git a/core/proto/android/os/incident.proto b/core/proto/android/os/incident.proto
index ab15d4f..503bd21 100644
--- a/core/proto/android/os/incident.proto
+++ b/core/proto/android/os/incident.proto
@@ -228,7 +228,7 @@
     ];
 
     optional android.service.print.PrintServiceDumpProto print = 3010 [
-        (section).type = SECTION_NONE, // Turn off until we get approval for it.
+        (section).type = SECTION_DUMPSYS,
         (section).args = "print --proto"
     ];
 
diff --git a/core/proto/android/server/activitymanagerservice.proto b/core/proto/android/server/activitymanagerservice.proto
index 0c617ff..418e15b 100644
--- a/core/proto/android/server/activitymanagerservice.proto
+++ b/core/proto/android/server/activitymanagerservice.proto
@@ -38,995 +38,995 @@
 option java_multiple_files = true;
 
 message ActivityManagerServiceProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional ActivityManagerServiceDumpActivitiesProto activities = 1;
+    optional ActivityManagerServiceDumpActivitiesProto activities = 1;
 
-  optional ActivityManagerServiceDumpBroadcastsProto broadcasts = 2;
+    optional ActivityManagerServiceDumpBroadcastsProto broadcasts = 2;
 
-  optional ActivityManagerServiceDumpServicesProto services = 3;
+    optional ActivityManagerServiceDumpServicesProto services = 3;
 
-  optional ActivityManagerServiceDumpProcessesProto processes = 4;
+    optional ActivityManagerServiceDumpProcessesProto processes = 4;
 }
 
 // "dumpsys activity --proto activities"
 message ActivityManagerServiceDumpActivitiesProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional ActivityStackSupervisorProto activity_stack_supervisor = 1;
+    optional ActivityStackSupervisorProto activity_stack_supervisor = 1;
 }
 
 message ActivityStackSupervisorProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional .com.android.server.wm.ConfigurationContainerProto configuration_container = 1;
-  repeated ActivityDisplayProto displays = 2;
-  optional KeyguardControllerProto keyguard_controller = 3;
-  optional int32 focused_stack_id = 4;
-  optional .com.android.server.wm.IdentifierProto resumed_activity = 5;
-  // Whether or not the home activity is the recents activity. This is needed for the CTS tests to
-  // know what activity types to check for when invoking splitscreen multi-window.
-  optional bool is_home_recents_component = 6;
+    optional .com.android.server.wm.ConfigurationContainerProto configuration_container = 1;
+    repeated ActivityDisplayProto displays = 2;
+    optional KeyguardControllerProto keyguard_controller = 3;
+    optional int32 focused_stack_id = 4;
+    optional .com.android.server.wm.IdentifierProto resumed_activity = 5;
+    // Whether or not the home activity is the recents activity. This is needed for the CTS tests to
+    // know what activity types to check for when invoking splitscreen multi-window.
+    optional bool is_home_recents_component = 6;
 }
 
 /* represents ActivityStackSupervisor.ActivityDisplay */
 message ActivityDisplayProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional .com.android.server.wm.ConfigurationContainerProto configuration_container = 1;
-  optional int32 id = 2;
-  repeated ActivityStackProto stacks = 3;
+    optional .com.android.server.wm.ConfigurationContainerProto configuration_container = 1;
+    optional int32 id = 2;
+    repeated ActivityStackProto stacks = 3;
 }
 
 message ActivityStackProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional .com.android.server.wm.ConfigurationContainerProto configuration_container = 1;
-  optional int32 id = 2;
-  repeated TaskRecordProto tasks = 3;
-  optional .com.android.server.wm.IdentifierProto resumed_activity = 4;
-  optional int32 display_id = 5;
-  optional bool fullscreen = 6;
-  optional .android.graphics.RectProto bounds = 7;
+    optional .com.android.server.wm.ConfigurationContainerProto configuration_container = 1;
+    optional int32 id = 2;
+    repeated TaskRecordProto tasks = 3;
+    optional .com.android.server.wm.IdentifierProto resumed_activity = 4;
+    optional int32 display_id = 5;
+    optional bool fullscreen = 6;
+    optional .android.graphics.RectProto bounds = 7;
 }
 
 message TaskRecordProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional .com.android.server.wm.ConfigurationContainerProto configuration_container = 1;
-  optional int32 id = 2;
-  repeated ActivityRecordProto activities = 3;
-  optional int32 stack_id = 4;
-  optional .android.graphics.RectProto last_non_fullscreen_bounds = 5;
-  optional string real_activity = 6;
-  optional string orig_activity = 7;
-  optional int32 activity_type = 8;
-  optional int32 resize_mode = 9;
-  optional bool fullscreen = 10;
-  optional .android.graphics.RectProto bounds = 11;
-  optional int32 min_width = 12;
-  optional int32 min_height = 13;
+    optional .com.android.server.wm.ConfigurationContainerProto configuration_container = 1;
+    optional int32 id = 2;
+    repeated ActivityRecordProto activities = 3;
+    optional int32 stack_id = 4;
+    optional .android.graphics.RectProto last_non_fullscreen_bounds = 5;
+    optional string real_activity = 6;
+    optional string orig_activity = 7;
+    optional int32 activity_type = 8;
+    optional int32 resize_mode = 9;
+    optional bool fullscreen = 10;
+    optional .android.graphics.RectProto bounds = 11;
+    optional int32 min_width = 12;
+    optional int32 min_height = 13;
 }
 
 message ActivityRecordProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional .com.android.server.wm.ConfigurationContainerProto configuration_container = 1;
-  optional .com.android.server.wm.IdentifierProto identifier = 2;
-  optional string state = 3;
-  optional bool visible = 4;
-  optional bool front_of_task = 5;
-  optional int32 proc_id = 6;
+    optional .com.android.server.wm.ConfigurationContainerProto configuration_container = 1;
+    optional .com.android.server.wm.IdentifierProto identifier = 2;
+    optional string state = 3;
+    optional bool visible = 4;
+    optional bool front_of_task = 5;
+    optional int32 proc_id = 6;
 }
 
 message KeyguardControllerProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional bool keyguard_showing = 1;
-  optional bool keyguard_occluded = 2;
+    optional bool keyguard_showing = 1;
+    optional bool keyguard_occluded = 2;
 }
 
 // "dumpsys activity --proto broadcasts"
 message ActivityManagerServiceDumpBroadcastsProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
-
-  repeated ReceiverListProto  receiver_list = 1;
-
-  optional .com.android.server.IntentResolverProto receiver_resolver = 2;
-
-  repeated BroadcastQueueProto broadcast_queue = 3;
-
-  repeated StickyBroadcastProto sticky_broadcasts = 4;
-
-  message MainHandler {
     option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-    optional string handler = 1;
-    optional .android.os.LooperProto looper = 2;
-  }
-  optional MainHandler handler = 5;
+    repeated ReceiverListProto receiver_list = 1;
+
+    optional .com.android.server.IntentResolverProto receiver_resolver = 2;
+
+    repeated BroadcastQueueProto broadcast_queue = 3;
+
+    repeated StickyBroadcastProto sticky_broadcasts = 4;
+
+    message MainHandler {
+        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+
+        optional string handler = 1;
+        optional .android.os.LooperProto looper = 2;
+    }
+    optional MainHandler handler = 5;
 }
 
 message ReceiverListProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional ProcessRecordProto app = 1;
-  optional int32 pid = 2;
-  optional int32 uid = 3;
-  optional int32 user = 4;
-  optional BroadcastRecordProto current = 5;
-  optional bool linked_to_death = 6;
-  repeated BroadcastFilterProto filters = 7;
-  optional string hex_hash = 8; // used to find this ReceiverList object in IntentResolver
+    optional ProcessRecordProto app = 1;
+    optional int32 pid = 2;
+    optional int32 uid = 3;
+    optional int32 user = 4;
+    optional BroadcastRecordProto current = 5;
+    optional bool linked_to_death = 6;
+    repeated BroadcastFilterProto filters = 7;
+    optional string hex_hash = 8; // used to find this ReceiverList object in IntentResolver
 }
 
 message ProcessRecordProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
-
-  optional int32 pid = 1;
-  optional string process_name = 2;
-  optional int32 uid = 3;
-  optional int32 user_id = 4;
-  optional int32 app_id = 5;
-  optional int32 isolated_app_id = 6;
-  optional bool persistent = 7;
-}
-
-message BroadcastRecordProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
-
-  optional int32 user_id = 1;
-  optional string intent_action = 2;
-}
-
-message BroadcastFilterProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
-
-  optional .android.content.IntentFilterProto intent_filter = 1;
-  optional string required_permission = 2;
-  optional string hex_hash = 3; // used to find the BroadcastFilter object in IntentResolver
-  optional int32 owning_user_id = 4;
-}
-
-message BroadcastQueueProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
-
-  optional string queue_name = 1;
-  repeated BroadcastRecordProto parallel_broadcasts = 2;
-  repeated BroadcastRecordProto ordered_broadcasts = 3;
-  optional BroadcastRecordProto pending_broadcast = 4;
-  repeated BroadcastRecordProto historical_broadcasts = 5;
-
-  message BroadcastSummary {
-    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
-
-    optional .android.content.IntentProto intent = 1;
-    optional int64 enqueue_clock_time_ms = 2;
-    optional int64 dispatch_clock_time_ms = 3;
-    optional int64 finish_clock_time_ms = 4;
-  }
-  repeated BroadcastSummary historical_broadcasts_summary = 6;
-}
-
-message MemInfoDumpProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
-
-  optional int64 uptime_duration_ms = 1;
-  optional int64 elapsed_realtime_ms = 2;
-
-  message ProcessMemory {
     option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
     optional int32 pid = 1;
     optional string process_name = 2;
+    optional int32 uid = 3;
+    optional int32 user_id = 4;
+    optional int32 app_id = 5;
+    optional int32 isolated_app_id = 6;
+    optional bool persistent = 7;
+}
 
-    message MemoryInfo {
-      option (.android.msg_privacy).dest = DEST_AUTOMATIC;
-
-      optional string name = 1;
-      // The proportional set size for the heap.
-      optional int32 total_pss_kb = 2;
-      // The proportional set size that is swappable for the heap.
-      optional int32 clean_pss_kb = 3;
-      // The private dirty pages used by the heap.
-      optional int32 shared_dirty_kb = 4;
-      // The shared dirty pages used by the heap.
-      optional int32 private_dirty_kb = 5;
-      // The shared clean pages used by the heap.
-      optional int32 shared_clean_kb = 6;
-      // The private clean pages used by the heap.
-      optional int32 private_clean_kb = 7;
-      oneof dirty_swap {
-        // The dirty the pages that have been swapped out.
-        int32 dirty_swap_kb = 8;
-        // The dirty the pages that have been swapped out, proportional.
-        int32 dirty_swap_pss_kb = 9;
-      }
-    }
-    message HeapInfo {
-      option (.android.msg_privacy).dest = DEST_AUTOMATIC;
-
-      optional MemoryInfo mem_info = 1;
-      optional int32 heap_size_kb = 2;
-      optional int32 heap_alloc_kb = 3;
-      optional int32 heap_free_kb = 4;
-    }
-    optional HeapInfo native_heap = 3;
-    optional HeapInfo dalvik_heap = 4;
-    repeated MemoryInfo other_heaps = 5;
-    optional MemoryInfo unknown_heap = 6;
-    // Summation of native_heap, dalvik_heap, and other_heaps.
-    optional HeapInfo total_heap = 7;
-
-    repeated MemoryInfo dalvik_details = 8;
-
-    message AppSummary {
-      option (.android.msg_privacy).dest = DEST_AUTOMATIC;
-
-      optional int32 java_heap_pss_kb = 1;
-      optional int32 native_heap_pss_kb = 2;
-      optional int32 code_pss_kb = 3;
-      optional int32 stack_pss_kb = 4;
-      optional int32 graphics_pss_kb = 5;
-      optional int32 private_other_pss_kb = 6;
-      optional int32 system_pss_kb = 7;
-
-      oneof total_swap {
-        int32 total_swap_pss = 8;
-        int32 total_swap_kb = 9;
-      }
-    }
-    optional AppSummary app_summary = 9;
-  }
-  repeated ProcessMemory native_processes = 3;
-
-  message AppData {
+message BroadcastRecordProto {
     option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-    optional ProcessMemory process_memory = 1;
+    optional int32 user_id = 1;
+    optional string intent_action = 2;
+}
 
-    message ObjectStats {
-      option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+message BroadcastFilterProto {
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-      optional int32 view_instance_count = 1;
-      optional int32 view_root_instance_count = 2;
-      optional int32 app_context_instance_count = 3;
-      optional int32 activity_instance_count = 4;
-      optional int32 global_asset_count = 5;
-      optional int32 global_asset_manager_count = 6;
-      optional int32 local_binder_object_count = 7;
-      optional int32 proxy_binder_object_count = 8;
-      optional int64 parcel_memory_kb = 9;
-      optional int32 parcel_count = 10;
-      optional int32 binder_object_death_count = 11;
-      optional int32 open_ssl_socket_count = 12;
-      optional int32 webview_instance_count = 13;
-    }
-    optional ObjectStats objects = 2;
+    optional .android.content.IntentFilterProto intent_filter = 1;
+    optional string required_permission = 2;
+    optional string hex_hash = 3; // used to find the BroadcastFilter object in IntentResolver
+    optional int32 owning_user_id = 4;
+}
 
-    message SqlStats {
-      option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+message BroadcastQueueProto {
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-      optional int32 memory_used_kb = 1;
-      optional int32 pagecache_overflow_kb = 2;
-      optional int32 malloc_size_kb = 3;
+    optional string queue_name = 1;
+    repeated BroadcastRecordProto parallel_broadcasts = 2;
+    repeated BroadcastRecordProto ordered_broadcasts = 3;
+    optional BroadcastRecordProto pending_broadcast = 4;
+    repeated BroadcastRecordProto historical_broadcasts = 5;
 
-      message Database {
+    message BroadcastSummary {
         option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-        optional string name = 1;
-        optional int32 page_size = 2;
-        optional int32 db_size = 3;
-        // Number of lookaside slots:
-        // http://www.sqlite.org/c3ref/c_dbstatus_lookaside_used.html
-        optional int32 lookaside_b = 4;
-        // Statement cache stats: hits/misses/cachesize
-        optional string cache = 5;
-      }
-      repeated Database databases = 4;
+        optional .android.content.IntentProto intent = 1;
+        optional int64 enqueue_clock_time_ms = 2;
+        optional int64 dispatch_clock_time_ms = 3;
+        optional int64 finish_clock_time_ms = 4;
     }
-    optional SqlStats sql = 3;
+    repeated BroadcastSummary historical_broadcasts_summary = 6;
+}
 
-    optional string asset_allocations = 4;
-    optional string unreachable_memory = 5;
-  }
-  repeated AppData app_processes = 4;
-
-  message MemItem {
+message MemInfoDumpProto {
     option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-    optional string tag = 1;
-    optional string label = 2;
-    optional int32 id = 3;
-    optional bool is_proc = 4;
-    optional bool has_activities = 5;
-    optional int64 pss_kb = 6;
-    optional int64 swap_pss_kb = 7;
-    repeated MemItem sub_items = 8;
-  }
-  repeated MemItem total_pss_by_process = 5;
-  repeated MemItem total_pss_by_oom_adjustment = 6;
-  repeated MemItem total_pss_by_category = 7;
+    optional int64 uptime_duration_ms = 1;
+    optional int64 elapsed_realtime_ms = 2;
 
-  optional int64 total_ram_kb = 8;
-  optional .com.android.internal.app.procstats.ProcessStatsProto.MemoryFactor status = 9;
-  // Total free RAM = cached_pss_kb + cached_kernel_kb + free_kb.
-  optional int64 cached_pss_kb = 10;
-  optional int64 cached_kernel_kb = 11;
-  optional int64 free_kb = 12;
-  // Total used RAM = used_pss_kb + used_kernel_kb.
-  optional int64 used_pss_kb = 13;
-  optional int64 used_kernel_kb = 14;
+    message ProcessMemory {
+        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional int64 lost_ram_kb = 15;
+        optional int32 pid = 1;
+        optional string process_name = 2;
 
-  optional int64 total_zram_kb = 16;
-  optional int64 zram_physical_used_in_swap_kb = 17;
-  optional int64 total_zram_swap_kb = 18;
+        message MemoryInfo {
+            option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional int64 ksm_sharing_kb = 19;
-  optional int64 ksm_shared_kb = 20;
-  optional int64 ksm_unshared_kb = 21;
-  optional int64 ksm_volatile_kb = 22;
+            optional string name = 1;
+            // The proportional set size for the heap.
+            optional int32 total_pss_kb = 2;
+            // The proportional set size that is swappable for the heap.
+            optional int32 clean_pss_kb = 3;
+            // The private dirty pages used by the heap.
+            optional int32 shared_dirty_kb = 4;
+            // The shared dirty pages used by the heap.
+            optional int32 private_dirty_kb = 5;
+            // The shared clean pages used by the heap.
+            optional int32 shared_clean_kb = 6;
+            // The private clean pages used by the heap.
+            optional int32 private_clean_kb = 7;
+            oneof dirty_swap {
+                // The dirty the pages that have been swapped out.
+                int32 dirty_swap_kb = 8;
+                // The dirty the pages that have been swapped out, proportional.
+                int32 dirty_swap_pss_kb = 9;
+            }
+        }
+        message HeapInfo {
+            option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  // The approximate per-application memory class of the current device. This
-  // gives developers an idea of how hard a memory limit you should impose on
-  // their application to let the overall system work best. The value is in
-  // megabytes; the baseline Android memory class is 16 (which happens to be the
-  // Java heap limit of those devices); some devices with more memory may have
-  // 24 or even higher numbers.
-  optional int32 tuning_mb = 23;
-  // The approximate per-application memory class of the current device when an
-  // application is running with a large heap. This is the space available for
-  // memory-intensive applications; most applications should not need this
-  // amount of memory, and should instead stay with the tuning_mb limit. The
-  // value is in megabytes. This may be the same size as tuning_mb on memory
-  // constrained devices, or it may be significantly larger on devices with a
-  // large amount of available RAM.
-  // This is the size of the application's Dalvik heap if it has specified
-  // 'android:largeHeap="true"' in its manifest.
-  optional int32 tuning_large_mb = 24;
+            optional MemoryInfo mem_info = 1;
+            optional int32 heap_size_kb = 2;
+            optional int32 heap_alloc_kb = 3;
+            optional int32 heap_free_kb = 4;
+        }
+        optional HeapInfo native_heap = 3;
+        optional HeapInfo dalvik_heap = 4;
+        repeated MemoryInfo other_heaps = 5;
+        optional MemoryInfo unknown_heap = 6;
+        // Summation of native_heap, dalvik_heap, and other_heaps.
+        optional HeapInfo total_heap = 7;
 
-  optional int64 oom_kb = 25;
+        repeated MemoryInfo dalvik_details = 8;
 
-  // The maximum pss size in kb that we consider a process acceptable to restore
-  // from its cached state for running in the background when RAM is low.
-  optional int64 restore_limit_kb = 26;
+        message AppSummary {
+            option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional bool is_low_ram_device = 27;
-  optional bool is_high_end_gfx = 28;
+            optional int32 java_heap_pss_kb = 1;
+            optional int32 native_heap_pss_kb = 2;
+            optional int32 code_pss_kb = 3;
+            optional int32 stack_pss_kb = 4;
+            optional int32 graphics_pss_kb = 5;
+            optional int32 private_other_pss_kb = 6;
+            optional int32 system_pss_kb = 7;
+
+            oneof total_swap {
+                int32 total_swap_pss = 8;
+                int32 total_swap_kb = 9;
+            }
+        }
+        optional AppSummary app_summary = 9;
+    }
+    repeated ProcessMemory native_processes = 3;
+
+    message AppData {
+        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+
+        optional ProcessMemory process_memory = 1;
+
+        message ObjectStats {
+            option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+
+            optional int32 view_instance_count = 1;
+            optional int32 view_root_instance_count = 2;
+            optional int32 app_context_instance_count = 3;
+            optional int32 activity_instance_count = 4;
+            optional int32 global_asset_count = 5;
+            optional int32 global_asset_manager_count = 6;
+            optional int32 local_binder_object_count = 7;
+            optional int32 proxy_binder_object_count = 8;
+            optional int64 parcel_memory_kb = 9;
+            optional int32 parcel_count = 10;
+            optional int32 binder_object_death_count = 11;
+            optional int32 open_ssl_socket_count = 12;
+            optional int32 webview_instance_count = 13;
+        }
+        optional ObjectStats objects = 2;
+
+        message SqlStats {
+            option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+
+            optional int32 memory_used_kb = 1;
+            optional int32 pagecache_overflow_kb = 2;
+            optional int32 malloc_size_kb = 3;
+
+            message Database {
+                option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+
+                optional string name = 1;
+                optional int32 page_size = 2;
+                optional int32 db_size = 3;
+                // Number of lookaside slots:
+                // http://www.sqlite.org/c3ref/c_dbstatus_lookaside_used.html
+                optional int32 lookaside_b = 4;
+                // Statement cache stats: hits/misses/cachesize
+                optional string cache = 5;
+            }
+            repeated Database databases = 4;
+        }
+        optional SqlStats sql = 3;
+
+        optional string asset_allocations = 4;
+        optional string unreachable_memory = 5;
+    }
+    repeated AppData app_processes = 4;
+
+    message MemItem {
+        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+
+        optional string tag = 1;
+        optional string label = 2;
+        optional int32 id = 3;
+        optional bool is_proc = 4;
+        optional bool has_activities = 5;
+        optional int64 pss_kb = 6;
+        optional int64 swap_pss_kb = 7;
+        repeated MemItem sub_items = 8;
+    }
+    repeated MemItem total_pss_by_process = 5;
+    repeated MemItem total_pss_by_oom_adjustment = 6;
+    repeated MemItem total_pss_by_category = 7;
+
+    optional int64 total_ram_kb = 8;
+    optional .com.android.internal.app.procstats.ProcessStatsProto.MemoryFactor status = 9;
+    // Total free RAM = cached_pss_kb + cached_kernel_kb + free_kb.
+    optional int64 cached_pss_kb = 10;
+    optional int64 cached_kernel_kb = 11;
+    optional int64 free_kb = 12;
+    // Total used RAM = used_pss_kb + used_kernel_kb.
+    optional int64 used_pss_kb = 13;
+    optional int64 used_kernel_kb = 14;
+
+    optional int64 lost_ram_kb = 15;
+
+    optional int64 total_zram_kb = 16;
+    optional int64 zram_physical_used_in_swap_kb = 17;
+    optional int64 total_zram_swap_kb = 18;
+
+    optional int64 ksm_sharing_kb = 19;
+    optional int64 ksm_shared_kb = 20;
+    optional int64 ksm_unshared_kb = 21;
+    optional int64 ksm_volatile_kb = 22;
+
+    // The approximate per-application memory class of the current device. This
+    // gives developers an idea of how hard a memory limit you should impose on
+    // their application to let the overall system work best. The value is in
+    // megabytes; the baseline Android memory class is 16 (which happens to be the
+    // Java heap limit of those devices); some devices with more memory may have
+    // 24 or even higher numbers.
+    optional int32 tuning_mb = 23;
+    // The approximate per-application memory class of the current device when an
+    // application is running with a large heap. This is the space available for
+    // memory-intensive applications; most applications should not need this
+    // amount of memory, and should instead stay with the tuning_mb limit. The
+    // value is in megabytes. This may be the same size as tuning_mb on memory
+    // constrained devices, or it may be significantly larger on devices with a
+    // large amount of available RAM.
+    // This is the size of the application's Dalvik heap if it has specified
+    // 'android:largeHeap="true"' in its manifest.
+    optional int32 tuning_large_mb = 24;
+
+    optional int64 oom_kb = 25;
+
+    // The maximum pss size in kb that we consider a process acceptable to restore
+    // from its cached state for running in the background when RAM is low.
+    optional int64 restore_limit_kb = 26;
+
+    optional bool is_low_ram_device = 27;
+    optional bool is_high_end_gfx = 28;
 }
 
 message StickyBroadcastProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
-
-  optional int32 user = 1;
-
-  message StickyAction {
     option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-    optional string name = 1;
-    repeated .android.content.IntentProto intents = 2;
-  }
-  repeated StickyAction actions = 2;
+    optional int32 user = 1;
+
+    message StickyAction {
+        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+
+        optional string name = 1;
+        repeated .android.content.IntentProto intents = 2;
+    }
+    repeated StickyAction actions = 2;
 }
 
 // "dumpsys activity --proto service"
 message ActivityManagerServiceDumpServicesProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional ActiveServicesProto active_services = 1;
+    optional ActiveServicesProto active_services = 1;
 }
 
 message ActiveServicesProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
-
-  message ServicesByUser {
     option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-    optional int32 user_id = 1;
-    repeated ServiceRecordProto service_records = 2;
-  }
-  repeated ServicesByUser services_by_users = 1;
+    message ServicesByUser {
+        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+
+        optional int32 user_id = 1;
+        repeated ServiceRecordProto service_records = 2;
+    }
+    repeated ServicesByUser services_by_users = 1;
 }
 
 // corresponds to ActivityManagerService.GrantUri Java class
 message GrantUriProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional int32 source_user_id = 1;
-  optional string uri = 2 [ (.android.privacy).dest = DEST_EXPLICIT ];
+    optional int32 source_user_id = 1;
+    optional string uri = 2 [ (.android.privacy).dest = DEST_EXPLICIT ];
 }
 
 message NeededUriGrantsProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional string target_package = 1;
-  optional int32 target_uid = 2;
-  optional int32 flags = 3;
+    optional string target_package = 1;
+    optional int32 target_uid = 2;
+    optional int32 flags = 3;
 
-  repeated GrantUriProto grants = 4;
+    repeated GrantUriProto grants = 4;
 }
 
 message UriPermissionOwnerProto {
-  option (.android.msg_privacy).dest = DEST_EXPLICIT;
+    option (.android.msg_privacy).dest = DEST_EXPLICIT;
 
-  optional string owner = 1;
-  repeated GrantUriProto read_perms = 2;
-  repeated GrantUriProto write_perms = 3;
+    optional string owner = 1;
+    repeated GrantUriProto read_perms = 2;
+    repeated GrantUriProto write_perms = 3;
 }
 
 message ServiceRecordProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
-
-  optional string short_name = 1;
-  optional bool is_running = 2; // false if the application service is null
-  optional int32 pid = 3;
-  optional .android.content.IntentProto intent = 4;
-  optional string package_name = 5;
-  optional string process_name = 6;
-  optional string permission = 7;
-
-  message AppInfo {
-    option (.android.msg_privacy).dest = DEST_EXPLICIT;
-
-    optional string base_dir = 1;
-    optional string res_dir = 2;
-    optional string data_dir = 3;
-  }
-  optional AppInfo appinfo = 8;
-  optional ProcessRecordProto app = 9;
-  optional ProcessRecordProto isolated_proc = 10;
-  optional bool whitelist_manager = 11;
-  optional bool delayed = 12;
-
-  message Foreground {
     option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-    optional int32 id = 1;
-    optional .android.app.NotificationProto notification = 2;
-  }
-  optional Foreground foreground = 13;
+    optional string short_name = 1;
+    optional bool is_running = 2; // false if the application service is null
+    optional int32 pid = 3;
+    optional .android.content.IntentProto intent = 4;
+    optional string package_name = 5;
+    optional string process_name = 6;
+    optional string permission = 7;
 
-  optional .android.util.Duration create_real_time = 14;
-  optional .android.util.Duration starting_bg_timeout = 15;
-  optional .android.util.Duration last_activity_time = 16;
-  optional .android.util.Duration restart_time = 17;
-  optional bool created_from_fg = 18;
+    message AppInfo {
+        option (.android.msg_privacy).dest = DEST_EXPLICIT;
 
-  // variables used to track states related to service start
-  message Start {
-    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+        optional string base_dir = 1;
+        optional string res_dir = 2;
+        optional string data_dir = 3;
+    }
+    optional AppInfo appinfo = 8;
+    optional ProcessRecordProto app = 9;
+    optional ProcessRecordProto isolated_proc = 10;
+    optional bool whitelist_manager = 11;
+    optional bool delayed = 12;
 
-    optional bool start_requested = 1;
-    optional bool delayed_stop = 2;
-    optional bool stop_if_killed = 3;
-    optional bool call_start = 4;
-    optional int32 last_start_id = 5;
-  }
-  optional Start start = 19;
+    message Foreground {
+        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  message ExecuteNesting {
-    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+        optional int32 id = 1;
+        optional .android.app.NotificationProto notification = 2;
+    }
+    optional Foreground foreground = 13;
 
-    optional int32 execute_nesting = 1;
-    optional bool execute_fg = 2;
-    optional .android.util.Duration executing_start = 3;
-  }
-  optional ExecuteNesting execute = 20;
+    optional .android.util.Duration create_real_time = 14;
+    optional .android.util.Duration starting_bg_timeout = 15;
+    optional .android.util.Duration last_activity_time = 16;
+    optional .android.util.Duration restart_time = 17;
+    optional bool created_from_fg = 18;
 
-  optional .android.util.Duration destory_time = 21;
+    // variables used to track states related to service start
+    message Start {
+        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  message Crash {
-    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+        optional bool start_requested = 1;
+        optional bool delayed_stop = 2;
+        optional bool stop_if_killed = 3;
+        optional bool call_start = 4;
+        optional int32 last_start_id = 5;
+    }
+    optional Start start = 19;
 
-    optional int32 restart_count = 1;
-    optional .android.util.Duration restart_delay = 2;
-    optional .android.util.Duration next_restart_time = 3;
-    optional int32 crash_count = 4;
-  }
-  optional Crash crash = 22;
+    message ExecuteNesting {
+        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  message StartItem {
-    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+        optional int32 execute_nesting = 1;
+        optional bool execute_fg = 2;
+        optional .android.util.Duration executing_start = 3;
+    }
+    optional ExecuteNesting execute = 20;
 
-    optional int32 id = 1;
-    optional .android.util.Duration duration = 2;
-    optional int32 delivery_count = 3;
-    optional int32 done_executing_count = 4;
-    optional .android.content.IntentProto intent = 5;
-    optional NeededUriGrantsProto needed_grants = 6;
-    optional UriPermissionOwnerProto uri_permissions = 7;
-  }
-  repeated StartItem delivered_starts = 23;
-  repeated StartItem pending_starts = 24;
+    optional .android.util.Duration destory_time = 21;
 
-  repeated IntentBindRecordProto bindings = 25;
-  repeated ConnectionRecordProto connections = 26;
+    message Crash {
+        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  // Next Tag: 27
+        optional int32 restart_count = 1;
+        optional .android.util.Duration restart_delay = 2;
+        optional .android.util.Duration next_restart_time = 3;
+        optional int32 crash_count = 4;
+    }
+    optional Crash crash = 22;
+
+    message StartItem {
+        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+
+        optional int32 id = 1;
+        optional .android.util.Duration duration = 2;
+        optional int32 delivery_count = 3;
+        optional int32 done_executing_count = 4;
+        optional .android.content.IntentProto intent = 5;
+        optional NeededUriGrantsProto needed_grants = 6;
+        optional UriPermissionOwnerProto uri_permissions = 7;
+    }
+    repeated StartItem delivered_starts = 23;
+    repeated StartItem pending_starts = 24;
+
+    repeated IntentBindRecordProto bindings = 25;
+    repeated ConnectionRecordProto connections = 26;
+
+    // Next Tag: 27
 }
 
 message ConnectionRecordProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  // used to find same record, e.g. AppBindRecord has the hex_hash
-  optional string hex_hash = 1; // cross reference the object and avoid double logging.
-  optional int32 user_id = 2;
+    // used to find same record, e.g. AppBindRecord has the hex_hash
+    optional string hex_hash = 1; // cross reference the object and avoid double logging.
+    optional int32 user_id = 2;
 
-  enum Flag {
-    AUTO_CREATE = 0;
-    DEBUG_UNBIND = 1;
-    NOT_FG = 2;
-    IMPORTANT_BG = 3;
-    ABOVE_CLIENT = 4;
-    ALLOW_OOM_MANAGEMENT = 5;
-    WAIVE_PRIORITY = 6;
-    IMPORTANT = 7;
-    ADJUST_WITH_ACTIVITY = 8;
-    FG_SERVICE_WHILE_AWAKE = 9;
-    FG_SERVICE = 10;
-    TREAT_LIKE_ACTIVITY = 11;
-    VISIBLE = 12;
-    SHOWING_UI = 13;
-    NOT_VISIBLE = 14;
-    DEAD = 15;
-  }
-  repeated Flag flags = 3;
-  optional string service_name = 4;
+    enum Flag {
+        AUTO_CREATE = 0;
+        DEBUG_UNBIND = 1;
+        NOT_FG = 2;
+        IMPORTANT_BG = 3;
+        ABOVE_CLIENT = 4;
+        ALLOW_OOM_MANAGEMENT = 5;
+        WAIVE_PRIORITY = 6;
+        IMPORTANT = 7;
+        ADJUST_WITH_ACTIVITY = 8;
+        FG_SERVICE_WHILE_AWAKE = 9;
+        FG_SERVICE = 10;
+        TREAT_LIKE_ACTIVITY = 11;
+        VISIBLE = 12;
+        SHOWING_UI = 13;
+        NOT_VISIBLE = 14;
+        DEAD = 15;
+    }
+    repeated Flag flags = 3;
+    optional string service_name = 4;
 }
 
 message AppBindRecordProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional string service_name = 1;
-  optional string client_proc_name = 2;
-  repeated string connections = 3; // hex_hash of ConnectionRecordProto
+    optional string service_name = 1;
+    optional string client_proc_name = 2;
+    repeated string connections = 3; // hex_hash of ConnectionRecordProto
 }
 
 message IntentBindRecordProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional .android.content.IntentProto intent = 1;
-  optional string binder = 2;
-  optional bool auto_create = 3; // value of BIND_AUTO_CREATE flag.
-  optional bool requested = 4;
-  optional bool received = 5;
-  optional bool has_bound = 6;
-  optional bool do_rebind = 7;
+    optional .android.content.IntentProto intent = 1;
+    optional string binder = 2;
+    optional bool auto_create = 3; // value of BIND_AUTO_CREATE flag.
+    optional bool requested = 4;
+    optional bool received = 5;
+    optional bool has_bound = 6;
+    optional bool do_rebind = 7;
 
-  repeated AppBindRecordProto apps = 8;
+    repeated AppBindRecordProto apps = 8;
 }
 
 // TODO: "dumpsys activity --proto processes"
 message ActivityManagerServiceDumpProcessesProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
-
-  repeated ProcessRecordProto procs = 1;
-  repeated ProcessRecordProto isolated_procs = 2;
-  repeated ActiveInstrumentationProto active_instrumentations = 3;
-  repeated UidRecordProto active_uids = 4;
-  repeated UidRecordProto validate_uids = 5;
-
-  // Process LRU list (sorted by oom_adj)
-  message LruProcesses {
     option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-    optional int32 size = 1;
-    optional int32 non_act_at = 2;
-    optional int32 non_svc_at = 3;
-    repeated ProcessOomProto list = 4;
-  }
-  optional LruProcesses lru_procs = 6;
-  repeated ProcessRecordProto pids_self_locked = 7;
-  // Foreground Processes
-  repeated ImportanceTokenProto important_procs = 8;
-  // Persisent processes that are starting
-  repeated ProcessRecordProto persistent_starting_procs = 9;
-  // Processes that are being removed
-  repeated ProcessRecordProto removed_procs = 10;
-  // Processes that are on old until the system is ready
-  repeated ProcessRecordProto on_hold_procs = 11;
-  // Processes that are waiting to GC
-  repeated ProcessToGcProto gc_procs = 12;
-  optional AppErrorsProto app_errors = 13;
-  optional UserControllerProto user_controller = 14;
-  optional ProcessRecordProto home_proc = 15;
-  optional ProcessRecordProto previous_proc = 16;
-  optional int64 previous_proc_visible_time_ms = 17;
-  optional ProcessRecordProto heavy_weight_proc = 18;
-  optional .android.content.ConfigurationProto global_configuration = 19;
-  // ActivityStackSupervisorProto dumps these values as well, still here?
-  // repeated ActivityDisplayProto displays = 20;
+    repeated ProcessRecordProto procs = 1;
+    repeated ProcessRecordProto isolated_procs = 2;
+    repeated ActiveInstrumentationProto active_instrumentations = 3;
+    repeated UidRecordProto active_uids = 4;
+    repeated UidRecordProto validate_uids = 5;
 
-  optional bool config_will_change = 21;
+    // Process LRU list (sorted by oom_adj)
+    message LruProcesses {
+        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  message ScreenCompatPackage {
-    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
-
-    optional string package = 1;
-    optional int32 mode = 2;
-  }
-  repeated ScreenCompatPackage screen_compat_packages = 22;
-
-  message UidObserverRegistrationProto {
-    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
-
-    optional int32 uid = 1;
-    optional string package = 2;
-    repeated .android.app.UidObserverFlag flags = 3;
-    optional int32 cut_point = 4; // only available when UID_OBSERVER_PROCSTATE is on
-
-    message ProcState {
-      option (.android.msg_privacy).dest = DEST_AUTOMATIC;
-
-      optional int32 uid = 1;
-      optional int32 state = 2;
+        optional int32 size = 1;
+        optional int32 non_act_at = 2;
+        optional int32 non_svc_at = 3;
+        repeated ProcessOomProto list = 4;
     }
-    repeated ProcState last_proc_states = 5;
-  }
-  repeated UidObserverRegistrationProto uid_observers = 23;
-  repeated int32 device_idle_whitelist = 24;
-  repeated int32 device_idle_temp_whitelist = 25;
+    optional LruProcesses lru_procs = 6;
+    repeated ProcessRecordProto pids_self_locked = 7;
+    // Foreground Processes
+    repeated ImportanceTokenProto important_procs = 8;
+    // Persisent processes that are starting
+    repeated ProcessRecordProto persistent_starting_procs = 9;
+    // Processes that are being removed
+    repeated ProcessRecordProto removed_procs = 10;
+    // Processes that are on old until the system is ready
+    repeated ProcessRecordProto on_hold_procs = 11;
+    // Processes that are waiting to GC
+    repeated ProcessToGcProto gc_procs = 12;
+    optional AppErrorsProto app_errors = 13;
+    optional UserControllerProto user_controller = 14;
+    optional ProcessRecordProto home_proc = 15;
+    optional ProcessRecordProto previous_proc = 16;
+    optional int64 previous_proc_visible_time_ms = 17;
+    optional ProcessRecordProto heavy_weight_proc = 18;
+    optional .android.content.ConfigurationProto global_configuration = 19;
+    // ActivityStackSupervisorProto dumps these values as well, still here?
+    // repeated ActivityDisplayProto displays = 20;
 
-  message PendingTempWhitelist {
-    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    optional bool config_will_change = 21;
 
-    optional int32 target_uid = 1;
-    optional int64 duration_ms = 2;
-    optional string tag = 3;
-  }
-  repeated PendingTempWhitelist pending_temp_whitelist = 26;
+    message ScreenCompatPackage {
+        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  message SleepStatus {
-    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+        optional string package = 1;
+        optional int32 mode = 2;
+    }
+    repeated ScreenCompatPackage screen_compat_packages = 22;
 
-    optional .android.os.PowerManagerInternalProto.Wakefulness wakefulness = 1;
-    repeated string sleep_tokens = 2 [ (.android.privacy).dest = DEST_EXPLICIT ];
-    optional bool sleeping = 3;
-    optional bool shutting_down = 4;
-    optional bool test_pss_mode = 5;
-  }
-  optional SleepStatus sleep_status = 27;
-
-  message Voice {
-    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
-
-    optional string session = 1;
-    optional .android.os.PowerManagerProto.WakeLock wakelock = 2;
-  }
-  optional Voice running_voice = 28;
-
-  optional VrControllerProto vr_controller = 29;
-
-  message DebugApp {
-    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
-
-    optional string debug_app = 1;
-    optional string orig_debug_app = 2;
-    optional bool debug_transient = 3;
-    optional bool orig_wait_for_debugger = 4;
-  }
-  optional DebugApp debug = 30;
-  optional AppTimeTrackerProto current_tracker = 31;
-
-  message MemWatchProcess {
-    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
-
-    message Process {
-      option (.android.msg_privacy).dest = DEST_AUTOMATIC;
-
-      optional string name = 1;
-
-      message MemStats {
+    message UidObserverRegistrationProto {
         option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
         optional int32 uid = 1;
-        optional string size = 2;
-        optional string report_to = 3;
-      }
-      repeated MemStats mem_stats = 2;
+        optional string package = 2;
+        repeated .android.app.UidObserverFlag flags = 3;
+        optional int32 cut_point = 4; // only available when UID_OBSERVER_PROCSTATE is on
+
+        message ProcState {
+            option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+
+            optional int32 uid = 1;
+            optional int32 state = 2;
+        }
+        repeated ProcState last_proc_states = 5;
     }
-    repeated Process procs = 1;
+    repeated UidObserverRegistrationProto uid_observers = 23;
+    repeated int32 device_idle_whitelist = 24;
+    repeated int32 device_idle_temp_whitelist = 25;
 
-    message Dump {
-      option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    message PendingTempWhitelist {
+        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-      optional string proc_name = 1;
-      optional string file = 2 [ (.android.privacy).dest = DEST_EXPLICIT ];
-      optional int32 pid = 3;
-      optional int32 uid = 4;
+        optional int32 target_uid = 1;
+        optional int64 duration_ms = 2;
+        optional string tag = 3;
     }
-    optional Dump dump = 2;
-  }
-  optional MemWatchProcess mem_watch_processes = 32;
-  optional string track_allocation_app = 33;
+    repeated PendingTempWhitelist pending_temp_whitelist = 26;
 
-  message Profile {
-    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    message SleepStatus {
+        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-    optional string app_name = 1;
-    optional ProcessRecordProto proc = 2;
-    optional .android.app.ProfilerInfoProto info = 3;
-    optional int32 type = 4;
-  }
-  optional Profile profile = 34;
-  optional string native_debugging_app = 35;
-  optional bool always_finish_activities = 36;
+        optional .android.os.PowerManagerInternalProto.Wakefulness wakefulness = 1;
+        repeated string sleep_tokens = 2 [ (.android.privacy).dest = DEST_EXPLICIT ];
+        optional bool sleeping = 3;
+        optional bool shutting_down = 4;
+        optional bool test_pss_mode = 5;
+    }
+    optional SleepStatus sleep_status = 27;
 
-  message Controller {
-    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    message Voice {
+        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-    optional string controller = 1;
-    optional bool is_a_monkey = 2;
-  }
-  optional Controller controller = 37;
+        optional string session = 1;
+        optional .android.os.PowerManagerProto.WakeLock wakelock = 2;
+    }
+    optional Voice running_voice = 28;
 
-  optional int32 total_persistent_procs = 38;
-  optional bool processes_ready = 39;
-  optional bool system_ready = 40;
-  optional bool booted = 41;
-  optional int32 factory_test = 42;
-  optional bool booting = 43;
-  optional bool call_finish_booting = 44;
-  optional bool boot_animation_complete = 45;
-  optional int64 last_power_check_uptime_ms = 46;
-  optional .android.os.PowerManagerProto.WakeLock going_to_sleep = 47;
-  optional .android.os.PowerManagerProto.WakeLock launching_activity = 48;
-  optional int32 adj_seq = 49;
-  optional int32 lru_seq = 50;
-  optional int32 num_non_cached_procs = 51;
-  optional int32 num_cached_hidden_procs = 52;
-  optional int32 num_service_procs = 53;
-  optional int32 new_num_service_procs = 54;
-  optional bool allow_lower_mem_level = 55;
-  optional int32 last_memory_level = 56;
-  optional int32 last_num_processes = 57;
-  optional .android.util.Duration last_idle_time = 58;
-  optional int64 low_ram_since_last_idle_ms = 59;
+    optional VrControllerProto vr_controller = 29;
+
+    message DebugApp {
+        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+
+        optional string debug_app = 1;
+        optional string orig_debug_app = 2;
+        optional bool debug_transient = 3;
+        optional bool orig_wait_for_debugger = 4;
+    }
+    optional DebugApp debug = 30;
+    optional AppTimeTrackerProto current_tracker = 31;
+
+    message MemWatchProcess {
+        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+
+        message Process {
+            option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+
+            optional string name = 1;
+
+            message MemStats {
+                option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+
+                optional int32 uid = 1;
+                optional string size = 2;
+                optional string report_to = 3;
+            }
+            repeated MemStats mem_stats = 2;
+        }
+        repeated Process procs = 1;
+
+        message Dump {
+            option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+
+            optional string proc_name = 1;
+            optional string file = 2 [ (.android.privacy).dest = DEST_EXPLICIT ];
+            optional int32 pid = 3;
+            optional int32 uid = 4;
+        }
+        optional Dump dump = 2;
+    }
+    optional MemWatchProcess mem_watch_processes = 32;
+    optional string track_allocation_app = 33;
+
+    message Profile {
+        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+
+        optional string app_name = 1;
+        optional ProcessRecordProto proc = 2;
+        optional .android.app.ProfilerInfoProto info = 3;
+        optional int32 type = 4;
+    }
+    optional Profile profile = 34;
+    optional string native_debugging_app = 35;
+    optional bool always_finish_activities = 36;
+
+    message Controller {
+        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+
+        optional string controller = 1;
+        optional bool is_a_monkey = 2;
+    }
+    optional Controller controller = 37;
+
+    optional int32 total_persistent_procs = 38;
+    optional bool processes_ready = 39;
+    optional bool system_ready = 40;
+    optional bool booted = 41;
+    optional int32 factory_test = 42;
+    optional bool booting = 43;
+    optional bool call_finish_booting = 44;
+    optional bool boot_animation_complete = 45;
+    optional int64 last_power_check_uptime_ms = 46;
+    optional .android.os.PowerManagerProto.WakeLock going_to_sleep = 47;
+    optional .android.os.PowerManagerProto.WakeLock launching_activity = 48;
+    optional int32 adj_seq = 49;
+    optional int32 lru_seq = 50;
+    optional int32 num_non_cached_procs = 51;
+    optional int32 num_cached_hidden_procs = 52;
+    optional int32 num_service_procs = 53;
+    optional int32 new_num_service_procs = 54;
+    optional bool allow_lower_mem_level = 55;
+    optional int32 last_memory_level = 56;
+    optional int32 last_num_processes = 57;
+    optional .android.util.Duration last_idle_time = 58;
+    optional int64 low_ram_since_last_idle_ms = 59;
 }
 
 message ActiveInstrumentationProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional .android.content.ComponentNameProto class = 1;
-  optional bool finished = 2;
-  repeated ProcessRecordProto running_processes = 3;
-  repeated string target_processes = 4;
-  optional .android.content.pm.ApplicationInfoProto target_info = 5;
-  optional string profile_file = 6;
-  optional string watcher = 7;
-  optional string ui_automation_connection = 8;
-  optional string arguments = 9  [ (.android.privacy).dest = DEST_EXPLICIT ];
+    optional .android.content.ComponentNameProto class = 1;
+    optional bool finished = 2;
+    repeated ProcessRecordProto running_processes = 3;
+    repeated string target_processes = 4;
+    optional .android.content.pm.ApplicationInfoProto target_info = 5;
+    optional string profile_file = 6;
+    optional string watcher = 7;
+    optional string ui_automation_connection = 8;
+    optional string arguments = 9 [ (.android.privacy).dest = DEST_EXPLICIT ];
 }
 
 // Proto definition of com.android.server.am.UidRecord.java
 message UidRecordProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
-
-  optional int32 uid = 1;
-  optional .android.app.ProcessStateEnum current = 2;
-  optional bool ephemeral = 3;
-  optional bool fg_services = 4;
-  optional bool whilelist = 5;
-  optional .android.util.Duration last_background_time = 6;
-  optional bool idle = 7;
-
-  enum Change {
-    CHANGE_GONE = 0;
-    CHANGE_IDLE = 1;
-    CHANGE_ACTIVE = 2;
-    CHANGE_CACHED = 3;
-    CHANGE_UNCACHED = 4;
-  }
-  repeated Change last_reported_changes = 8;
-  optional int32 num_procs = 9;
-
-  message ProcStateSequence {
     option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-    optional int64 cururent = 1;
-    optional int64 last_network_updated = 2;
-    optional int64 last_dispatched = 3;
-  }
-  optional ProcStateSequence network_state_update = 10;
+    optional int32 uid = 1;
+    optional .android.app.ProcessStateEnum current = 2;
+    optional bool ephemeral = 3;
+    optional bool fg_services = 4;
+    optional bool whilelist = 5;
+    optional .android.util.Duration last_background_time = 6;
+    optional bool idle = 7;
 
-  // Next Tag: 11
+    enum Change {
+        CHANGE_GONE = 0;
+        CHANGE_IDLE = 1;
+        CHANGE_ACTIVE = 2;
+        CHANGE_CACHED = 3;
+        CHANGE_UNCACHED = 4;
+    }
+    repeated Change last_reported_changes = 8;
+    optional int32 num_procs = 9;
+
+    message ProcStateSequence {
+        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+
+        optional int64 cururent = 1;
+        optional int64 last_network_updated = 2;
+        optional int64 last_dispatched = 3;
+    }
+    optional ProcStateSequence network_state_update = 10;
+
+    // Next Tag: 11
 }
 
 // proto of class ImportanceToken in ActivityManagerService
 message ImportanceTokenProto {
-  option (.android.msg_privacy).dest = DEST_EXPLICIT;
+    option (.android.msg_privacy).dest = DEST_EXPLICIT;
 
-  optional int32 pid = 1;
-  optional string token = 2;
-  optional string reason = 3;
+    optional int32 pid = 1;
+    optional string token = 2;
+    optional string reason = 3;
 }
 
 // proto of class VrController.java
 message VrControllerProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  enum VrMode {
-    FLAG_NON_VR_MODE = 0;
-    FLAG_VR_MODE = 1;
-    FLAG_PERSISTENT_VR_MODE = 2;
-  }
-  repeated VrMode vr_mode = 1;
-  optional int32 render_thread_id = 2;
+    enum VrMode {
+        FLAG_NON_VR_MODE = 0;
+        FLAG_VR_MODE = 1;
+        FLAG_PERSISTENT_VR_MODE = 2;
+    }
+    repeated VrMode vr_mode = 1;
+    optional int32 render_thread_id = 2;
 }
 
 message ProcessOomProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
-
-  optional bool persistent = 1;
-  optional int32 num = 2;
-  optional string oom_adj = 3;
-
-  // Activity manager's version of Process enum, see ProcessList.java
-  enum SchedGroup {
-    SCHED_GROUP_UNKNOWN = -1;
-    SCHED_GROUP_BACKGROUND = 0;
-    SCHED_GROUP_DEFAULT = 1;
-    SCHED_GROUP_TOP_APP = 2;
-    SCHED_GROUP_TOP_APP_BOUND = 3;
-  }
-  optional SchedGroup sched_group = 4 [ default = SCHED_GROUP_UNKNOWN];
-
-  oneof Foreground {
-    bool activities = 5;
-    bool services = 6;
-  }
-
-  optional .android.app.ProcessStateEnum state = 7;
-  optional int32 trim_memory_level = 8;
-  optional ProcessRecordProto proc = 9;
-  optional string adj_type = 10;
-
-  oneof AdjTarget {
-    .android.content.ComponentNameProto adj_target_component_name = 11;
-    string adj_target_object = 12;
-  }
-
-  oneof AdjSource {
-    ProcessRecordProto adj_source_proc = 13;
-    string adj_source_object = 14;
-  }
-
-  message Detail {
     option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-    optional int32 max_adj = 1;
-    optional int32 cur_raw_adj = 2;
-    optional int32 set_raw_adj = 3;
-    optional int32 cur_adj = 4;
-    optional int32 set_adj = 5;
-    optional .android.app.ProcessStateEnum current_state = 7;
-    optional .android.app.ProcessStateEnum set_state = 8;
-    optional string last_pss = 9;
-    optional string last_swap_pss = 10;
-    optional string last_cached_pss = 11;
-    optional bool cached = 12;
-    optional bool empty = 13;
-    optional bool has_above_client = 14;
+    optional bool persistent = 1;
+    optional int32 num = 2;
+    optional string oom_adj = 3;
 
-    // only make sense if process is a service
-    message CpuRunTime {
-      option (.android.msg_privacy).dest = DEST_AUTOMATIC;
-
-      optional int64 over_ms = 1;
-      optional int64 used_ms = 2;
-      optional float ultilization = 3; // ratio of cpu time usage
+    // Activity manager's version of Process enum, see ProcessList.java
+    enum SchedGroup {
+        SCHED_GROUP_UNKNOWN = -1;
+        SCHED_GROUP_BACKGROUND = 0;
+        SCHED_GROUP_DEFAULT = 1;
+        SCHED_GROUP_TOP_APP = 2;
+        SCHED_GROUP_TOP_APP_BOUND = 3;
     }
-    optional CpuRunTime service_run_time = 15;
-  }
-  optional Detail detail = 15;
+    optional SchedGroup sched_group = 4 [ default = SCHED_GROUP_UNKNOWN];
+
+    oneof Foreground {
+        bool activities = 5;
+        bool services = 6;
+    }
+
+    optional .android.app.ProcessStateEnum state = 7;
+    optional int32 trim_memory_level = 8;
+    optional ProcessRecordProto proc = 9;
+    optional string adj_type = 10;
+
+    oneof AdjTarget {
+        .android.content.ComponentNameProto adj_target_component_name = 11;
+        string adj_target_object = 12;
+    }
+
+    oneof AdjSource {
+        ProcessRecordProto adj_source_proc = 13;
+        string adj_source_object = 14;
+    }
+
+    message Detail {
+        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+
+        optional int32 max_adj = 1;
+        optional int32 cur_raw_adj = 2;
+        optional int32 set_raw_adj = 3;
+        optional int32 cur_adj = 4;
+        optional int32 set_adj = 5;
+        optional .android.app.ProcessStateEnum current_state = 7;
+        optional .android.app.ProcessStateEnum set_state = 8;
+        optional string last_pss = 9;
+        optional string last_swap_pss = 10;
+        optional string last_cached_pss = 11;
+        optional bool cached = 12;
+        optional bool empty = 13;
+        optional bool has_above_client = 14;
+
+        // only make sense if process is a service
+        message CpuRunTime {
+            option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+
+            optional int64 over_ms = 1;
+            optional int64 used_ms = 2;
+            optional float ultilization = 3; // ratio of cpu time usage
+        }
+        optional CpuRunTime service_run_time = 15;
+    }
+    optional Detail detail = 15;
 }
 
 message ProcessToGcProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional ProcessRecordProto proc = 1;
-  optional bool report_low_memory = 2;
-  optional int64 now_uptime_ms = 3;
-  optional int64 last_gced_ms = 4;
-  optional int64 last_low_memory_ms = 5;
+    optional ProcessRecordProto proc = 1;
+    optional bool report_low_memory = 2;
+    optional int64 now_uptime_ms = 3;
+    optional int64 last_gced_ms = 4;
+    optional int64 last_low_memory_ms = 5;
 }
 
 // sync with com.android.server.am.AppErrors.java
 message AppErrorsProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
-
-  optional int64 now_uptime_ms = 1;
-
-  message ProcessCrashTime {
     option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-    optional string process_name = 1;
+    optional int64 now_uptime_ms = 1;
 
-    message Entry {
-      option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    message ProcessCrashTime {
+        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-      optional int32 uid = 1;
-      optional int64 last_crashed_at_ms = 2;
+        optional string process_name = 1;
+
+        message Entry {
+            option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+
+            optional int32 uid = 1;
+            optional int64 last_crashed_at_ms = 2;
+        }
+        repeated Entry entries = 2;
     }
-    repeated Entry entries = 2;
-  }
-  repeated ProcessCrashTime process_crash_times = 2;
+    repeated ProcessCrashTime process_crash_times = 2;
 
-  message BadProcess {
-    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    message BadProcess {
+        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-    optional string process_name = 1;
+        optional string process_name = 1;
 
-    message Entry {
-      option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+        message Entry {
+            option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-      optional int32 uid = 1;
-      optional int64 crashed_at_ms = 2;
-      optional string short_msg = 3;
-      optional string long_msg = 4  [ (.android.privacy).dest = DEST_EXPLICIT ];
-      optional string stack = 5  [ (.android.privacy).dest = DEST_EXPLICIT ];
+            optional int32 uid = 1;
+            optional int64 crashed_at_ms = 2;
+            optional string short_msg = 3;
+            optional string long_msg = 4 [ (.android.privacy).dest = DEST_EXPLICIT ];
+            optional string stack = 5 [ (.android.privacy).dest = DEST_EXPLICIT ];
+        }
+        repeated Entry entries = 2;
     }
-    repeated Entry entries = 2;
-  }
-  repeated BadProcess bad_processes = 3;
+    repeated BadProcess bad_processes = 3;
 }
 
 // sync with com.android.server.am.UserState.java
 message UserStateProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  enum State {
-    STATE_BOOTING = 0;
-    STATE_RUNNING_LOCKED = 1;
-    STATE_RUNNING_UNLOCKING = 2;
-    STATE_RUNNING_UNLOCKED = 3;
-    STATE_STOPPING = 4;
-    STATE_SHUTDOWN = 5;
-  }
-  optional State state = 1;
-  optional bool switching = 2;
+    enum State {
+        STATE_BOOTING = 0;
+        STATE_RUNNING_LOCKED = 1;
+        STATE_RUNNING_UNLOCKING = 2;
+        STATE_RUNNING_UNLOCKED = 3;
+        STATE_STOPPING = 4;
+        STATE_SHUTDOWN = 5;
+    }
+    optional State state = 1;
+    optional bool switching = 2;
 }
 
 // sync with com.android.server.am.UserController.java
 message UserControllerProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
-
-  message User {
     option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-    optional int32 id = 1;
-    optional UserStateProto state = 2;
-  }
-  repeated User started_users = 1;
-  repeated int32 started_user_array = 2;
-  repeated int32 user_lru = 3;
+    message User {
+        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  message UserProfile {
-    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+        optional int32 id = 1;
+        optional UserStateProto state = 2;
+    }
+    repeated User started_users = 1;
+    repeated int32 started_user_array = 2;
+    repeated int32 user_lru = 3;
 
-    optional int32 user = 1;
-    optional int32 profile = 2;
-  }
-  repeated UserProfile user_profile_group_ids = 4;
+    message UserProfile {
+        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+
+        optional int32 user = 1;
+        optional int32 profile = 2;
+    }
+    repeated UserProfile user_profile_group_ids = 4;
 }
 
 // sync with com.android.server.am.AppTimeTracker.java
 message AppTimeTrackerProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
-
-  optional string receiver = 1;
-  optional int64 total_duration_ms = 2;
-
-  message PackageTime {
     option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-    optional string package = 1;
-    optional int64 duration_ms = 2;
-  }
-  repeated PackageTime package_times = 3;
+    optional string receiver = 1;
+    optional int64 total_duration_ms = 2;
 
-  optional .android.util.Duration started_time = 4;
-  optional string started_package = 5;
+    message PackageTime {
+        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+
+        optional string package = 1;
+        optional int64 duration_ms = 2;
+    }
+    repeated PackageTime package_times = 3;
+
+    optional .android.util.Duration started_time = 4;
+    optional string started_package = 5;
 }
diff --git a/core/proto/android/server/alarmmanagerservice.proto b/core/proto/android/server/alarmmanagerservice.proto
index 53e3ba9..eef78d1 100644
--- a/core/proto/android/server/alarmmanagerservice.proto
+++ b/core/proto/android/server/alarmmanagerservice.proto
@@ -29,254 +29,254 @@
 
 // next ID: 43
 message AlarmManagerServiceDumpProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
-
-  optional int64 current_time = 1;
-  optional int64 elapsed_realtime = 2;
-  optional int64 last_time_change_clock_time = 3;
-  optional int64 last_time_change_realtime = 4;
-  // Current settings
-  optional ConstantsProto settings = 5;
-
-  // Dump from ForceAppStandbyTracker.
-  optional ForceAppStandbyTrackerProto force_app_standby_tracker = 6;
-
-  optional bool is_interactive = 7;
-  // Only valid if is_interactive is false.
-  optional int64 time_since_non_interactive_ms = 8;
-  // Only valid if is_interactive is false.
-  optional int64 max_wakeup_delay_ms = 9;
-  // Only valid if is_interactive is false.
-  optional int64 time_since_last_dispatch_ms = 10;
-  // Only valid if is_interactive is false.
-  optional int64 time_until_next_non_wakeup_delivery_ms = 11;
-
-  // Can be negative if the non-wakeup alarm time is in the past (non-wakeup
-  // alarms aren't delivered unil the next time the device wakes up).
-  optional int64 time_until_next_non_wakeup_alarm_ms = 12;
-  optional int64 time_until_next_wakeup_ms = 13;
-  optional int64 time_since_last_wakeup_ms = 14;
-  // Time since the last wakeup was set.
-  optional int64 time_since_last_wakeup_set_ms = 15;
-  optional int64 time_change_event_count = 16;
-  // The current set of user whitelisted apps for device idle mode, meaning
-  // these are allowed to freely schedule alarms. These are app IDs, not UIDs.
-  repeated int32 device_idle_user_whitelist_app_ids = 17;
-
-  repeated AlarmClockMetadataProto next_alarm_clock_metadata = 18;
-
-  repeated BatchProto pending_alarm_batches = 19;
-
-  // List of alarms per uid deferred due to user applied background restrictions
-  // on the source app.
-  repeated AlarmProto pending_user_blocked_background_alarms = 20;
-
-  // When idling mode will end. Will be empty if the device is not currently
-  // idling.
-  optional AlarmProto pending_idle_until = 21;
-
-  // Any alarms that we don't want to run during idle mode. Will be empty if the
-  // device is not currently idling.
-  repeated AlarmProto pending_while_idle_alarms = 22;
-
-  // This is a special alarm that will put the system into idle until it goes
-  // off. The caller has given the time they want this to happen at.
-  optional AlarmProto next_wake_from_idle = 23;
-
-  repeated AlarmProto past_due_non_wakeup_alarms = 24;
-
-  // Number of delayed alarms.
-  optional int32 delayed_alarm_count = 25;
-  // The total amount of time alarms had been delayed. Overlapping alarms are
-  // only counted once (ie. If two alarms were meant to trigger at the same time
-  // but were delayed by 5 seconds, the total time would be 5 seconds).
-  optional int64 total_delay_time_ms = 26;
-  optional int64 max_delay_duration_ms = 27;
-  optional int64 max_non_interactive_duration_ms = 28;
-
-  optional int32 broadcast_ref_count = 29;
-  // Canonical count of (operation.send() - onSendFinished()) and listener
-  // send/complete/timeout invocations.
-  optional int32 pending_intent_send_count = 30;
-  optional int32 pending_intent_finish_count = 31;
-  optional int32 listener_send_count = 32;
-  optional int32 listener_finish_count = 33;
-
-  repeated InFlightProto outstanding_deliveries = 34;
-
-  message LastAllowWhileIdleDispatch {
     option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-    optional int32 uid = 1;
-    // In the 'elapsed' timebase.
-    optional int64 time_ms = 2;
+    optional int64 current_time = 1;
+    optional int64 elapsed_realtime = 2;
+    optional int64 last_time_change_clock_time = 3;
+    optional int64 last_time_change_realtime = 4;
+    // Current settings
+    optional ConstantsProto settings = 5;
 
-    // Time when the next while-idle is allowed, in the 'elapsed' timebase.
-    optional int64 next_allowed_ms = 3;
-  }
+    // Dump from ForceAppStandbyTracker.
+    optional ForceAppStandbyTrackerProto force_app_standby_tracker = 6;
 
-  // Whether the short or long while-idle timeout should be used for each UID.
-  repeated int32 use_allow_while_idle_short_time = 35;
+    optional bool is_interactive = 7;
+    // Only valid if is_interactive is false.
+    optional int64 time_since_non_interactive_ms = 8;
+    // Only valid if is_interactive is false.
+    optional int64 max_wakeup_delay_ms = 9;
+    // Only valid if is_interactive is false.
+    optional int64 time_since_last_dispatch_ms = 10;
+    // Only valid if is_interactive is false.
+    optional int64 time_until_next_non_wakeup_delivery_ms = 11;
 
-  // For each uid, this is the last time we dispatched an "allow while idle"
-  // alarm, used to determine the earliest we can dispatch the next such alarm.
-  repeated LastAllowWhileIdleDispatch last_allow_while_idle_dispatch_times = 36;
+    // Can be negative if the non-wakeup alarm time is in the past (non-wakeup
+    // alarms aren't delivered unil the next time the device wakes up).
+    optional int64 time_until_next_non_wakeup_alarm_ms = 12;
+    optional int64 time_until_next_wakeup_ms = 13;
+    optional int64 time_since_last_wakeup_ms = 14;
+    // Time since the last wakeup was set.
+    optional int64 time_since_last_wakeup_set_ms = 15;
+    optional int64 time_change_event_count = 16;
+    // The current set of user whitelisted apps for device idle mode, meaning
+    // these are allowed to freely schedule alarms. These are app IDs, not UIDs.
+    repeated int32 device_idle_user_whitelist_app_ids = 17;
 
-  optional com.android.internal.util.LocalLogProto recent_problems = 37;
+    repeated AlarmClockMetadataProto next_alarm_clock_metadata = 18;
 
-  message TopAlarm {
-    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    repeated BatchProto pending_alarm_batches = 19;
 
-    optional int32 uid = 1;
-    optional string package_name = 2;
-    optional FilterStatsProto filter = 3;
-  }
-  repeated TopAlarm top_alarms = 38;
+    // List of alarms per uid deferred due to user applied background restrictions
+    // on the source app.
+    repeated AlarmProto pending_user_blocked_background_alarms = 20;
 
-  message AlarmStat {
-    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    // When idling mode will end. Will be empty if the device is not currently
+    // idling.
+    optional AlarmProto pending_idle_until = 21;
 
-    optional BroadcastStatsProto broadcast = 1;
-    repeated FilterStatsProto filters = 2;
-  }
-  repeated AlarmStat alarm_stats = 39;
+    // Any alarms that we don't want to run during idle mode. Will be empty if the
+    // device is not currently idling.
+    repeated AlarmProto pending_while_idle_alarms = 22;
 
-  repeated IdleDispatchEntryProto allow_while_idle_dispatches = 40;
-  repeated WakeupEventProto recent_wakeup_history = 41;
+    // This is a special alarm that will put the system into idle until it goes
+    // off. The caller has given the time they want this to happen at.
+    optional AlarmProto next_wake_from_idle = 23;
+
+    repeated AlarmProto past_due_non_wakeup_alarms = 24;
+
+    // Number of delayed alarms.
+    optional int32 delayed_alarm_count = 25;
+    // The total amount of time alarms had been delayed. Overlapping alarms are
+    // only counted once (ie. If two alarms were meant to trigger at the same time
+    // but were delayed by 5 seconds, the total time would be 5 seconds).
+    optional int64 total_delay_time_ms = 26;
+    optional int64 max_delay_duration_ms = 27;
+    optional int64 max_non_interactive_duration_ms = 28;
+
+    optional int32 broadcast_ref_count = 29;
+    // Canonical count of (operation.send() - onSendFinished()) and listener
+    // send/complete/timeout invocations.
+    optional int32 pending_intent_send_count = 30;
+    optional int32 pending_intent_finish_count = 31;
+    optional int32 listener_send_count = 32;
+    optional int32 listener_finish_count = 33;
+
+    repeated InFlightProto outstanding_deliveries = 34;
+
+    message LastAllowWhileIdleDispatch {
+        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+
+        optional int32 uid = 1;
+        // In the 'elapsed' timebase.
+        optional int64 time_ms = 2;
+
+        // Time when the next while-idle is allowed, in the 'elapsed' timebase.
+        optional int64 next_allowed_ms = 3;
+    }
+
+    // Whether the short or long while-idle timeout should be used for each UID.
+    repeated int32 use_allow_while_idle_short_time = 35;
+
+    // For each uid, this is the last time we dispatched an "allow while idle"
+    // alarm, used to determine the earliest we can dispatch the next such alarm.
+    repeated LastAllowWhileIdleDispatch last_allow_while_idle_dispatch_times = 36;
+
+    optional com.android.internal.util.LocalLogProto recent_problems = 37;
+
+    message TopAlarm {
+        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+
+        optional int32 uid = 1;
+        optional string package_name = 2;
+        optional FilterStatsProto filter = 3;
+    }
+    repeated TopAlarm top_alarms = 38;
+
+    message AlarmStat {
+        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+
+        optional BroadcastStatsProto broadcast = 1;
+        repeated FilterStatsProto filters = 2;
+    }
+    repeated AlarmStat alarm_stats = 39;
+
+    repeated IdleDispatchEntryProto allow_while_idle_dispatches = 40;
+    repeated WakeupEventProto recent_wakeup_history = 41;
 }
 
 // This is a soft wrapper for alarm clock information. It is not representative
 // of an android.app.AlarmManager.AlarmClockInfo object.
 message AlarmClockMetadataProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional int32 user = 1;
-  optional bool is_pending_send = 2;
-  // This value is UTC wall clock time in milliseconds, as returned by
-  // System#currentTimeMillis() for example.
-  optional int64 trigger_time_ms = 3;
+    optional int32 user = 1;
+    optional bool is_pending_send = 2;
+    // This value is UTC wall clock time in milliseconds, as returned by
+    // System#currentTimeMillis() for example.
+    optional int64 trigger_time_ms = 3;
 }
 
 // A com.android.server.AlarmManagerService.Alarm object.
 message AlarmProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional string tag = 1 [ (.android.privacy).dest = DEST_EXPLICIT ];
-  optional .android.app.AlarmManagerProto.AlarmType type = 2;
-  // How long until the alarm goes off, in the 'elapsed' timebase. Can be
-  // negative if 'when' is in the past.
-  optional int64 time_until_when_elapsed_ms = 3;
-  optional int64 window_length_ms = 4;
-  optional int64 repeat_interval_ms = 5;
-  optional int32 count = 6;
-  optional int32 flags = 7;
-  optional .android.app.AlarmClockInfoProto alarm_clock = 8;
-  optional .android.app.PendingIntentProto operation = 9;
-  optional string listener = 10 [ (.android.privacy).dest = DEST_EXPLICIT ];
+    optional string tag = 1 [ (.android.privacy).dest = DEST_EXPLICIT ];
+    optional .android.app.AlarmManagerProto.AlarmType type = 2;
+    // How long until the alarm goes off, in the 'elapsed' timebase. Can be
+    // negative if 'when' is in the past.
+    optional int64 time_until_when_elapsed_ms = 3;
+    optional int64 window_length_ms = 4;
+    optional int64 repeat_interval_ms = 5;
+    optional int32 count = 6;
+    optional int32 flags = 7;
+    optional .android.app.AlarmClockInfoProto alarm_clock = 8;
+    optional .android.app.PendingIntentProto operation = 9;
+    optional string listener = 10 [ (.android.privacy).dest = DEST_EXPLICIT ];
 }
 
 // A com.android.server.AlarmManagerService.Batch object.
 message BatchProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  // Start time in terms of elapsed realtime.
-  optional int64 start_realtime = 1;
-  // End time in terms of elapsed realtime.
-  optional int64 end_realtime = 2;
-  optional int32 flags = 3;
-  repeated AlarmProto alarms = 4;
+    // Start time in terms of elapsed realtime.
+    optional int64 start_realtime = 1;
+    // End time in terms of elapsed realtime.
+    optional int64 end_realtime = 2;
+    optional int32 flags = 3;
+    repeated AlarmProto alarms = 4;
 }
 
 // A com.android.server.AlarmManagerService.BroadcastStats object.
 message BroadcastStatsProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional int32 uid = 1;
-  optional string package_name = 2;
-  // The total amount of time this broadcast was in flight.
-  optional int64 total_flight_duration_ms = 3;
-  optional int32 count = 4;
-  optional int32 wakeup_count = 5;
-  // The last time this first became active (when nesting changed from 0 to 1)
-  // in terms of elapsed realtime.
-  optional int64 start_time_realtime = 6;
-  // The broadcast is active if nesting > 0.
-  optional int32 nesting = 7;
+    optional int32 uid = 1;
+    optional string package_name = 2;
+    // The total amount of time this broadcast was in flight.
+    optional int64 total_flight_duration_ms = 3;
+    optional int32 count = 4;
+    optional int32 wakeup_count = 5;
+    // The last time this first became active (when nesting changed from 0 to 1)
+    // in terms of elapsed realtime.
+    optional int64 start_time_realtime = 6;
+    // The broadcast is active if nesting > 0.
+    optional int32 nesting = 7;
 }
 
 // A com.android.server.AlarmManagerService.Constants object.
 message ConstantsProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  // Minimum futurity of a new alarm.
-  optional int64 min_futurity_duration_ms = 1;
-  // Minimum alarm recurrence interval.
-  optional int64 min_interval_duration_ms = 2;
-  // Direct alarm listener callback timeout.
-  optional int64 listener_timeout_duration_ms = 3;
-  // Minimum time between ALLOW_WHILE_IDLE alarms when system is not idle.
-  optional int64 allow_while_idle_short_duration_ms = 4;
-  // Minimum time between ALLOW_WHILE_IDLE alarms when system is idling.
-  optional int64 allow_while_idle_long_duration_ms = 5;
-  // BroadcastOptions.setTemporaryAppWhitelistDuration() to use for FLAG_ALLOW_WHILE_IDLE.
-  optional int64 allow_while_idle_whitelist_duration_ms = 6;
-  // Maximum alarm recurrence interval.
-  optional int64 max_interval_duration_ms = 7;
+    // Minimum futurity of a new alarm.
+    optional int64 min_futurity_duration_ms = 1;
+    // Minimum alarm recurrence interval.
+    optional int64 min_interval_duration_ms = 2;
+    // Direct alarm listener callback timeout.
+    optional int64 listener_timeout_duration_ms = 3;
+    // Minimum time between ALLOW_WHILE_IDLE alarms when system is not idle.
+    optional int64 allow_while_idle_short_duration_ms = 4;
+    // Minimum time between ALLOW_WHILE_IDLE alarms when system is idling.
+    optional int64 allow_while_idle_long_duration_ms = 5;
+    // BroadcastOptions.setTemporaryAppWhitelistDuration() to use for FLAG_ALLOW_WHILE_IDLE.
+    optional int64 allow_while_idle_whitelist_duration_ms = 6;
+    // Maximum alarm recurrence interval.
+    optional int64 max_interval_duration_ms = 7;
 }
 
 // A com.android.server.AlarmManagerService.FilterStats object.
 message FilterStatsProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional string tag = 1 [ (.android.privacy).dest = DEST_EXPLICIT ];
-  // The last time this filter when in flight, in terms of elapsed realtime.
-  optional int64 last_flight_time_realtime = 2;
-  // The total amount of time this filter was in flight.
-  optional int64 total_flight_duration_ms = 3;
-  optional int32 count = 4;
-  optional int32 wakeup_count = 5;
-  // The last time this first became active (when nesting changed from 0 to 1)
-  // in terms of elapsed realtime.
-  optional int64 start_time_realtime = 6;
-  // The filter is active if nesting > 0.
-  optional int32 nesting = 7;
+    optional string tag = 1 [ (.android.privacy).dest = DEST_EXPLICIT ];
+    // The last time this filter when in flight, in terms of elapsed realtime.
+    optional int64 last_flight_time_realtime = 2;
+    // The total amount of time this filter was in flight.
+    optional int64 total_flight_duration_ms = 3;
+    optional int32 count = 4;
+    optional int32 wakeup_count = 5;
+    // The last time this first became active (when nesting changed from 0 to 1)
+    // in terms of elapsed realtime.
+    optional int64 start_time_realtime = 6;
+    // The filter is active if nesting > 0.
+    optional int32 nesting = 7;
 }
 
 // A com.android.server.AlarmManagerService.IdleDispatchEntry object.
 message IdleDispatchEntryProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional int32 uid = 1;
-  optional string pkg = 2;
-  optional string tag = 3 [ (.android.privacy).dest = DEST_EXPLICIT ];
-  optional string op = 4;
-  // Time when this entry was created, in terms of elapsed realtime.
-  optional int64 entry_creation_realtime = 5;
-  // For a RESCHEDULED op, this is the last time we dispatched an "allow while
-  // idle" alarm for the UID. For a SET op, this is when the alarm was
-  // triggered. Times are in the 'elapsed' timebase.
-  optional int64 arg_realtime = 6;
+    optional int32 uid = 1;
+    optional string pkg = 2;
+    optional string tag = 3 [ (.android.privacy).dest = DEST_EXPLICIT ];
+    optional string op = 4;
+    // Time when this entry was created, in terms of elapsed realtime.
+    optional int64 entry_creation_realtime = 5;
+    // For a RESCHEDULED op, this is the last time we dispatched an "allow while
+    // idle" alarm for the UID. For a SET op, this is when the alarm was
+    // triggered. Times are in the 'elapsed' timebase.
+    optional int64 arg_realtime = 6;
 }
 
 // A com.android.server.AlarmManagerService.InFlight object.
 message InFlightProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional int32 uid = 1;
-  optional string tag = 2 [ (.android.privacy).dest = DEST_EXPLICIT ];
-  optional int64 when_elapsed_ms = 3;
-  optional .android.app.AlarmManagerProto.AlarmType alarm_type = 4;
-  optional .android.app.PendingIntentProto pending_intent = 5;
-  optional BroadcastStatsProto broadcast_stats = 6;
-  optional FilterStatsProto filter_stats = 7;
-  optional .android.os.WorkSourceProto work_source = 8;
+    optional int32 uid = 1;
+    optional string tag = 2 [ (.android.privacy).dest = DEST_EXPLICIT ];
+    optional int64 when_elapsed_ms = 3;
+    optional .android.app.AlarmManagerProto.AlarmType alarm_type = 4;
+    optional .android.app.PendingIntentProto pending_intent = 5;
+    optional BroadcastStatsProto broadcast_stats = 6;
+    optional FilterStatsProto filter_stats = 7;
+    optional .android.os.WorkSourceProto work_source = 8;
 }
 
 // A com.android.server.AlarmManagerService.WakeupEvent object.
 message WakeupEventProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional int32 uid = 1;
-  optional string action = 2;
-  optional int64 when = 3;
+    optional int32 uid = 1;
+    optional string action = 2;
+    optional int64 when = 3;
 }
diff --git a/core/proto/android/server/animationadapter.proto b/core/proto/android/server/animationadapter.proto
index 9bfa794..0bcc488 100644
--- a/core/proto/android/server/animationadapter.proto
+++ b/core/proto/android/server/animationadapter.proto
@@ -24,55 +24,55 @@
 option java_multiple_files = true;
 
 message AnimationAdapterProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional LocalAnimationAdapterProto local = 1;
-  optional RemoteAnimationAdapterWrapperProto remote = 2;
+    optional LocalAnimationAdapterProto local = 1;
+    optional RemoteAnimationAdapterWrapperProto remote = 2;
 }
 
 /* represents RemoteAnimationAdapterWrapper */
 message RemoteAnimationAdapterWrapperProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional .android.view.RemoteAnimationTargetProto target = 1;
+    optional .android.view.RemoteAnimationTargetProto target = 1;
 }
 
 /* represents LocalAnimationAdapter */
 message LocalAnimationAdapterProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional AnimationSpecProto animation_spec = 1;
+    optional AnimationSpecProto animation_spec = 1;
 }
 
 message AnimationSpecProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional WindowAnimationSpecProto window = 1;
-  optional MoveAnimationSpecProto move = 2;
-  optional AlphaAnimationSpecProto alpha = 3;
+    optional WindowAnimationSpecProto window = 1;
+    optional MoveAnimationSpecProto move = 2;
+    optional AlphaAnimationSpecProto alpha = 3;
 }
 
 /* represents WindowAnimationSpec */
 message WindowAnimationSpecProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional string animation = 1;
+    optional string animation = 1;
 }
 
 /* represents MoveAnimationSpec*/
 message MoveAnimationSpecProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional .android.graphics.PointProto from = 1;
-  optional .android.graphics.PointProto to = 2;
-  optional int64 duration = 3;
+    optional .android.graphics.PointProto from = 1;
+    optional .android.graphics.PointProto to = 2;
+    optional int64 duration_ms = 3;
 }
 
 /* represents AlphaAnimationSpec */
 message AlphaAnimationSpecProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional float from = 1;
-  optional float to = 2;
-  optional int64 duration = 3;
-}
\ No newline at end of file
+    optional float from = 1;
+    optional float to = 2;
+    optional int64 duration_ms = 3;
+}
diff --git a/core/proto/android/server/appwindowthumbnail.proto b/core/proto/android/server/appwindowthumbnail.proto
index 54ad193..a1be721 100644
--- a/core/proto/android/server/appwindowthumbnail.proto
+++ b/core/proto/android/server/appwindowthumbnail.proto
@@ -26,9 +26,9 @@
  * Represents a {@link com.android.server.wm.AppWindowThumbnail} object.
  */
 message AppWindowThumbnailProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional int32 width = 1;
-  optional int32 height = 2;
-  optional SurfaceAnimatorProto surface_animator = 3;
-}
\ No newline at end of file
+    optional int32 width = 1;
+    optional int32 height = 2;
+    optional SurfaceAnimatorProto surface_animator = 3;
+}
diff --git a/core/proto/android/server/forceappstandbytracker.proto b/core/proto/android/server/forceappstandbytracker.proto
index 5296e47..1113d6a 100644
--- a/core/proto/android/server/forceappstandbytracker.proto
+++ b/core/proto/android/server/forceappstandbytracker.proto
@@ -27,51 +27,51 @@
 //
 // Next ID: 12
 message ForceAppStandbyTrackerProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
-
-  // Whether all apps are forced standby or not.
-  optional bool force_all_apps_standby = 1;
-
-  // UIDs currently active.
-  repeated int32 active_uids = 2;
-
-  // UIDs currently in the foreground.
-  repeated int32 foreground_uids = 11;
-
-  // App ids that are in power-save whitelist.
-  repeated int32 power_save_whitelist_app_ids = 3;
-
-  // App ids that are in temporary power-save whitelist.
-  repeated int32 temp_power_save_whitelist_app_ids = 4;
-
-  message RunAnyInBackgroundRestrictedPackages {
     option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-    optional int32 uid = 1;
-    optional string package_name = 2;
-  }
-  // Packages that are disallowed OP_RUN_ANY_IN_BACKGROUND.
-  repeated RunAnyInBackgroundRestrictedPackages run_any_in_background_restricted_packages = 5;
+    // Whether all apps are forced standby or not.
+    optional bool force_all_apps_standby = 1;
 
-  // Whether device is a small battery device
-  optional bool is_small_battery_device = 6;
+    // UIDs currently active.
+    repeated int32 active_uids = 2;
 
-  // Whether force app standby for small battery device setting is enabled
-  optional bool force_all_apps_standby_for_small_battery = 7;
+    // UIDs currently in the foreground.
+    repeated int32 foreground_uids = 11;
 
-  // Whether device is plugged in to the charger
-  optional bool is_plugged_in = 8;
+    // App ids that are in power-save whitelist.
+    repeated int32 power_save_whitelist_app_ids = 3;
 
-  // Performance stats.
-  optional StatLoggerProto stats = 9;
+    // App ids that are in temporary power-save whitelist.
+    repeated int32 temp_power_save_whitelist_app_ids = 4;
 
-  message ExemptedPackage {
-    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    message RunAnyInBackgroundRestrictedPackages {
+        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-    optional int32 userId = 1;
-    optional string package_name = 2;
-  }
+        optional int32 uid = 1;
+        optional string package_name = 2;
+    }
+    // Packages that are disallowed OP_RUN_ANY_IN_BACKGROUND.
+    repeated RunAnyInBackgroundRestrictedPackages run_any_in_background_restricted_packages = 5;
 
-  // Packages that are in the EXEMPT bucket.
-  repeated ExemptedPackage exempted_packages = 10;
+    // Whether device is a small battery device
+    optional bool is_small_battery_device = 6;
+
+    // Whether force app standby for small battery device setting is enabled
+    optional bool force_all_apps_standby_for_small_battery = 7;
+
+    // Whether device is plugged in to the charger
+    optional bool is_plugged_in = 8;
+
+    // Performance stats.
+    optional StatLoggerProto stats = 9;
+
+    message ExemptedPackage {
+        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+
+        optional int32 userId = 1;
+        optional string package_name = 2;
+    }
+
+    // Packages that are in the EXEMPT bucket.
+    repeated ExemptedPackage exempted_packages = 10;
 }
diff --git a/core/proto/android/server/jobscheduler.proto b/core/proto/android/server/jobscheduler.proto
index 4df3b63..0a10cec 100644
--- a/core/proto/android/server/jobscheduler.proto
+++ b/core/proto/android/server/jobscheduler.proto
@@ -219,23 +219,6 @@
 message StateControllerProto {
     option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-    message AppIdleController {
-        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
-
-        optional bool is_parole_on = 1;
-
-        message TrackedJob {
-            option (.android.msg_privacy).dest = DEST_AUTOMATIC;
-
-            optional JobStatusShortInfoProto info = 1;
-            optional int32 source_uid = 2;
-            optional string source_package_name = 3;
-            // If the constraints are satisfied, then the controller will mark
-            // the job as RUNNABLE, otherwise, it will be WAITING.
-            optional bool are_constraints_satisfied = 4;
-        }
-        repeated TrackedJob tracked_jobs = 2;
-    }
     message BackgroundJobsController {
         option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
@@ -413,15 +396,14 @@
         repeated TrackedJob tracked_jobs = 4;
     }
     oneof controller {
-        AppIdleController app_idle = 1;
-        BackgroundJobsController background = 2;
-        BatteryController battery = 3;
-        ConnectivityController connectivity = 4;
-        ContentObserverController content_observer = 5;
-        DeviceIdleJobsController device_idle = 6;
-        IdleController idle = 7;
-        StorageController storage = 8;
-        TimeController time = 9;
+        BackgroundJobsController background = 1;
+        BatteryController battery = 2;
+        ConnectivityController connectivity = 3;
+        ContentObserverController content_observer = 4;
+        DeviceIdleJobsController device_idle = 5;
+        IdleController idle = 6;
+        StorageController storage = 7;
+        TimeController time = 8;
     }
 }
 
@@ -618,8 +600,8 @@
         CONSTRAINT_DEADLINE = 5;
         CONSTRAINT_IDLE = 6;
         CONSTRAINT_CONNECTIVITY = 7;
-        CONSTRAINT_CONTENT_TRIGGER = 9;
-        CONSTRAINT_DEVICE_NOT_DOZING = 10;
+        CONSTRAINT_CONTENT_TRIGGER = 8;
+        CONSTRAINT_DEVICE_NOT_DOZING = 9;
     }
     repeated Constraint required_constraints = 7;
     repeated Constraint satisfied_constraints = 8;
diff --git a/core/proto/android/server/powermanagerservice.proto b/core/proto/android/server/powermanagerservice.proto
index eb60942..cee556a 100644
--- a/core/proto/android/server/powermanagerservice.proto
+++ b/core/proto/android/server/powermanagerservice.proto
@@ -313,36 +313,41 @@
 }
 
 message BatterySaverStateMachineProto {
-   // Whether battery saver is enabled.
-   optional bool enabled = 1;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-   // Whether system has booted.
-   optional bool boot_completed = 2;
+    // Whether battery saver is enabled.
+    optional bool enabled = 1;
 
-   // Whether settings have been loaded already.
-   optional bool settings_loaded = 3;
+    // Whether system has booted.
+    optional bool boot_completed = 2;
 
-   // Whether battery status has been set at least once.
-   optional bool battery_status_set = 4;
+    // Whether settings have been loaded already.
+    optional bool settings_loaded = 3;
 
-   // Whether automatic battery saver has been canceled by the user.
-   optional bool battery_saver_snoozing = 5;
+    // Whether battery status has been set at least once.
+    optional bool battery_status_set = 4;
 
-   // Whether the device is connected to any power source.
-   optional bool is_powered = 6;
+    // Whether automatic battery saver has been canceled by the user.
+    optional bool battery_saver_snoozing = 5;
 
-   // Current battery level in %, 0-100.
-   optional int32 battery_level = 7;
+    // Whether the device is connected to any power source.
+    optional bool is_powered = 6;
 
-   // Whether battery level is low or not.
-   optional bool is_battery_level_low = 8;
+    // Current battery level in %, 0-100.
+    optional int32 battery_level = 7;
 
-   // The value of Global.LOW_POWER_MODE.
-   optional bool setting_battery_saver_enabled = 9;
+    // Whether battery level is low or not.
+    optional bool is_battery_level_low = 8;
 
-   // The value of Global.LOW_POWER_MODE_STICKY.
-   optional bool setting_battery_saver_enabled_sticky = 10;
+    // The value of Global.LOW_POWER_MODE. This is a cached value, so it could
+    // be slightly different from what's in GlobalSettingsProto.LowPowerMode.
+    optional bool setting_battery_saver_enabled = 9;
 
-   // The value of Global.LOW_POWER_MODE_TRIGGER_LEVEL.
-   optional int32 setting_battery_saver_trigger_threshold = 11;
-}
\ No newline at end of file
+    // The value of Global.LOW_POWER_MODE_STICKY. This is a cached value, so it could
+    // be slightly different from what's in GlobalSettingsProto.LowPowerMode.
+    optional bool setting_battery_saver_enabled_sticky = 10;
+
+    // The value of Global.LOW_POWER_MODE_TRIGGER_LEVEL. This is a cached value, so it could
+    // be slightly different from what's in GlobalSettingsProto.LowPowerMode.
+    optional int32 setting_battery_saver_trigger_threshold = 11;
+}
diff --git a/core/proto/android/server/statlogger.proto b/core/proto/android/server/statlogger.proto
index 2b7daea..46badc4 100644
--- a/core/proto/android/server/statlogger.proto
+++ b/core/proto/android/server/statlogger.proto
@@ -24,17 +24,17 @@
 
 // Dump from StatLogger.
 message StatLoggerProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
-
-  message Event {
     option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-    optional int32 eventId = 1;
-    // Labels are hard-coded in Android framework code.
-    optional string label = 2;
-    optional int32 count = 3;
-    optional int64 total_duration_micros = 4;
-  }
+    message Event {
+        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  repeated Event events = 1;
+        optional int32 eventId = 1;
+        // Labels are hard-coded in Android framework code.
+        optional string label = 2;
+        optional int32 count = 3;
+        optional int64 total_duration_micros = 4;
+    }
+
+    repeated Event events = 1;
 }
diff --git a/core/proto/android/server/surfaceanimator.proto b/core/proto/android/server/surfaceanimator.proto
index 84560bc..e3e8baa 100644
--- a/core/proto/android/server/surfaceanimator.proto
+++ b/core/proto/android/server/surfaceanimator.proto
@@ -27,10 +27,9 @@
  * Represents a {@link com.android.server.wm.SurfaceAnimator} object.
  */
 message SurfaceAnimatorProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  reserved 1; // Was string animation_adapter = 1
-  optional .android.view.SurfaceControlProto leash = 2;
-  optional bool animation_start_delayed = 3;
-  optional AnimationAdapterProto animation_adapter = 4;
-}
\ No newline at end of file
+    optional .android.view.SurfaceControlProto leash = 1;
+    optional bool animation_start_delayed = 2;
+    optional AnimationAdapterProto animation_adapter = 3;
+}
diff --git a/core/proto/android/server/windowmanagerservice.proto b/core/proto/android/server/windowmanagerservice.proto
index ee371c1..7467d8f 100644
--- a/core/proto/android/server/windowmanagerservice.proto
+++ b/core/proto/android/server/windowmanagerservice.proto
@@ -33,350 +33,350 @@
 option java_multiple_files = true;
 
 message WindowManagerServiceDumpProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional WindowManagerPolicyProto policy = 1;
-  /* window hierarchy root */
-  optional RootWindowContainerProto root_window_container = 2;
-  optional IdentifierProto focused_window = 3;
-  optional string focused_app = 4;
-  optional IdentifierProto input_method_window = 5;
-  optional bool display_frozen = 6;
-  optional int32 rotation = 7;
-  optional int32 last_orientation = 8;
-  optional AppTransitionProto app_transition = 9;
+    optional WindowManagerPolicyProto policy = 1;
+    /* window hierarchy root */
+    optional RootWindowContainerProto root_window_container = 2;
+    optional IdentifierProto focused_window = 3;
+    optional string focused_app = 4;
+    optional IdentifierProto input_method_window = 5;
+    optional bool display_frozen = 6;
+    optional int32 rotation = 7;
+    optional int32 last_orientation = 8;
+    optional AppTransitionProto app_transition = 9;
 }
 
 /* represents DisplayContent */
 message RootWindowContainerProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional WindowContainerProto window_container = 1;
-  repeated DisplayProto displays = 2;
-  /* window references in top down z order */
-  repeated IdentifierProto windows = 3;
+    optional WindowContainerProto window_container = 1;
+    repeated DisplayProto displays = 2;
+    /* window references in top down z order */
+    repeated IdentifierProto windows = 3;
 }
 
 message BarControllerProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional .android.app.StatusBarManagerProto.WindowState state = 1;
-  optional .android.app.StatusBarManagerProto.TransientWindowState transient_state = 2;
+    optional .android.app.StatusBarManagerProto.WindowState state = 1;
+    optional .android.app.StatusBarManagerProto.TransientWindowState transient_state = 2;
 }
 
 message WindowOrientationListenerProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional bool enabled = 1;
-  optional .android.view.SurfaceProto.Rotation rotation = 2;
+    optional bool enabled = 1;
+    optional .android.view.SurfaceProto.Rotation rotation = 2;
 }
 
 message KeyguardServiceDelegateProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional bool showing = 1;
-  optional bool occluded = 2;
-  optional bool secure = 3;
-  enum ScreenState {
-    SCREEN_STATE_OFF = 0;
-    SCREEN_STATE_TURNING_ON = 1;
-    SCREEN_STATE_ON = 2;
-    SCREEN_STATE_TURNING_OFF = 3;
-  }
-  optional ScreenState screen_state = 4;
-  enum InteractiveState {
-    INTERACTIVE_STATE_SLEEP = 0;
-    INTERACTIVE_STATE_WAKING = 1;
-    INTERACTIVE_STATE_AWAKE = 2;
-    INTERACTIVE_STATE_GOING_TO_SLEEP = 3;
-  }
-  optional InteractiveState interactive_state = 5;
+    optional bool showing = 1;
+    optional bool occluded = 2;
+    optional bool secure = 3;
+    enum ScreenState {
+        SCREEN_STATE_OFF = 0;
+        SCREEN_STATE_TURNING_ON = 1;
+        SCREEN_STATE_ON = 2;
+        SCREEN_STATE_TURNING_OFF = 3;
+    }
+    optional ScreenState screen_state = 4;
+    enum InteractiveState {
+        INTERACTIVE_STATE_SLEEP = 0;
+        INTERACTIVE_STATE_WAKING = 1;
+        INTERACTIVE_STATE_AWAKE = 2;
+        INTERACTIVE_STATE_GOING_TO_SLEEP = 3;
+    }
+    optional InteractiveState interactive_state = 5;
 }
 
 /* represents PhoneWindowManager */
 message WindowManagerPolicyProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional int32 last_system_ui_flags = 1;
-  enum UserRotationMode {
-    USER_ROTATION_FREE = 0;
-    USER_ROTATION_LOCKED = 1;
-  }
-  optional UserRotationMode rotation_mode = 2;
-  optional .android.view.SurfaceProto.Rotation rotation = 3;
-  optional .android.content.ActivityInfoProto.ScreenOrientation orientation = 4;
-  optional bool screen_on_fully = 5;
-  optional bool keyguard_draw_complete = 6;
-  optional bool window_manager_draw_complete = 7;
-  optional string focused_app_token = 8;
-  optional IdentifierProto focused_window = 9;
-  optional IdentifierProto top_fullscreen_opaque_window = 10;
-  optional IdentifierProto top_fullscreen_opaque_or_dimming_window = 11;
-  optional bool keyguard_occluded = 12;
-  optional bool keyguard_occluded_changed = 13;
-  optional bool keyguard_occluded_pending = 14;
-  optional bool force_status_bar = 15;
-  optional bool force_status_bar_from_keyguard = 16;
-  optional BarControllerProto status_bar = 17;
-  optional BarControllerProto navigation_bar = 18;
-  optional WindowOrientationListenerProto orientation_listener = 19;
-  optional KeyguardServiceDelegateProto keyguard_delegate = 20;
+    optional int32 last_system_ui_flags = 1;
+    enum UserRotationMode {
+        USER_ROTATION_FREE = 0;
+        USER_ROTATION_LOCKED = 1;
+    }
+    optional UserRotationMode rotation_mode = 2;
+    optional .android.view.SurfaceProto.Rotation rotation = 3;
+    optional .android.content.ActivityInfoProto.ScreenOrientation orientation = 4;
+    optional bool screen_on_fully = 5;
+    optional bool keyguard_draw_complete = 6;
+    optional bool window_manager_draw_complete = 7;
+    optional string focused_app_token = 8;
+    optional IdentifierProto focused_window = 9;
+    optional IdentifierProto top_fullscreen_opaque_window = 10;
+    optional IdentifierProto top_fullscreen_opaque_or_dimming_window = 11;
+    optional bool keyguard_occluded = 12;
+    optional bool keyguard_occluded_changed = 13;
+    optional bool keyguard_occluded_pending = 14;
+    optional bool force_status_bar = 15;
+    optional bool force_status_bar_from_keyguard = 16;
+    optional BarControllerProto status_bar = 17;
+    optional BarControllerProto navigation_bar = 18;
+    optional WindowOrientationListenerProto orientation_listener = 19;
+    optional KeyguardServiceDelegateProto keyguard_delegate = 20;
 }
 
 /* represents AppTransition */
 message AppTransitionProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  enum AppState {
-    APP_STATE_IDLE = 0;
-    APP_STATE_READY = 1;
-    APP_STATE_RUNNING = 2;
-    APP_STATE_TIMEOUT = 3;
-  }
-  optional AppState app_transition_state = 1;
-  /* definitions for constants found in {@link com.android.server.wm.AppTransition} */
-  enum TransitionType {
-    TRANSIT_NONE = 0;
-    TRANSIT_UNSET = -1;
-    TRANSIT_ACTIVITY_OPEN = 6;
-    TRANSIT_ACTIVITY_CLOSE = 7;
-    TRANSIT_TASK_OPEN = 8;
-    TRANSIT_TASK_CLOSE = 9;
-    TRANSIT_TASK_TO_FRONT = 10;
-    TRANSIT_TASK_TO_BACK = 11;
-    TRANSIT_WALLPAPER_CLOSE = 12;
-    TRANSIT_WALLPAPER_OPEN = 13;
-    TRANSIT_WALLPAPER_INTRA_OPEN = 14;
-    TRANSIT_WALLPAPER_INTRA_CLOSE = 15;
-    TRANSIT_TASK_OPEN_BEHIND = 16;
-    TRANSIT_TASK_IN_PLACE = 17;
-    TRANSIT_ACTIVITY_RELAUNCH = 18;
-    TRANSIT_DOCK_TASK_FROM_RECENTS = 19;
-    TRANSIT_KEYGUARD_GOING_AWAY = 20;
-    TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER = 21;
-    TRANSIT_KEYGUARD_OCCLUDE = 22;
-    TRANSIT_KEYGUARD_UNOCCLUDE = 23;
-    TRANSIT_TRANSLUCENT_ACTIVITY_OPEN = 24;
-    TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE = 25;
-  }
-  optional TransitionType last_used_app_transition = 2;
+    enum AppState {
+        APP_STATE_IDLE = 0;
+        APP_STATE_READY = 1;
+        APP_STATE_RUNNING = 2;
+        APP_STATE_TIMEOUT = 3;
+    }
+    optional AppState app_transition_state = 1;
+    /* definitions for constants found in {@link com.android.server.wm.AppTransition} */
+    enum TransitionType {
+        TRANSIT_NONE = 0;
+        TRANSIT_UNSET = -1;
+        TRANSIT_ACTIVITY_OPEN = 6;
+        TRANSIT_ACTIVITY_CLOSE = 7;
+        TRANSIT_TASK_OPEN = 8;
+        TRANSIT_TASK_CLOSE = 9;
+        TRANSIT_TASK_TO_FRONT = 10;
+        TRANSIT_TASK_TO_BACK = 11;
+        TRANSIT_WALLPAPER_CLOSE = 12;
+        TRANSIT_WALLPAPER_OPEN = 13;
+        TRANSIT_WALLPAPER_INTRA_OPEN = 14;
+        TRANSIT_WALLPAPER_INTRA_CLOSE = 15;
+        TRANSIT_TASK_OPEN_BEHIND = 16;
+        TRANSIT_TASK_IN_PLACE = 17;
+        TRANSIT_ACTIVITY_RELAUNCH = 18;
+        TRANSIT_DOCK_TASK_FROM_RECENTS = 19;
+        TRANSIT_KEYGUARD_GOING_AWAY = 20;
+        TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER = 21;
+        TRANSIT_KEYGUARD_OCCLUDE = 22;
+        TRANSIT_KEYGUARD_UNOCCLUDE = 23;
+        TRANSIT_TRANSLUCENT_ACTIVITY_OPEN = 24;
+        TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE = 25;
+    }
+    optional TransitionType last_used_app_transition = 2;
 }
 
 /* represents DisplayContent */
 message DisplayProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional WindowContainerProto window_container = 1;
-  optional int32 id = 2;
-  repeated StackProto stacks = 3;
-  optional DockedStackDividerControllerProto docked_stack_divider_controller = 4;
-  optional PinnedStackControllerProto pinned_stack_controller = 5;
-  /* non app windows */
-  repeated WindowTokenProto above_app_windows = 6;
-  repeated WindowTokenProto below_app_windows = 7;
-  repeated WindowTokenProto ime_windows = 8;
-  optional int32 dpi = 9;
-  optional .android.view.DisplayInfoProto display_info = 10;
-  optional int32 rotation = 11;
-  optional ScreenRotationAnimationProto screen_rotation_animation = 12;
-  optional DisplayFramesProto display_frames = 13;
+    optional WindowContainerProto window_container = 1;
+    optional int32 id = 2;
+    repeated StackProto stacks = 3;
+    optional DockedStackDividerControllerProto docked_stack_divider_controller = 4;
+    optional PinnedStackControllerProto pinned_stack_controller = 5;
+    /* non app windows */
+    repeated WindowTokenProto above_app_windows = 6;
+    repeated WindowTokenProto below_app_windows = 7;
+    repeated WindowTokenProto ime_windows = 8;
+    optional int32 dpi = 9;
+    optional .android.view.DisplayInfoProto display_info = 10;
+    optional int32 rotation = 11;
+    optional ScreenRotationAnimationProto screen_rotation_animation = 12;
+    optional DisplayFramesProto display_frames = 13;
 }
 
 /* represents DisplayFrames */
 message DisplayFramesProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional .android.graphics.RectProto stable_bounds = 1;
+    optional .android.graphics.RectProto stable_bounds = 1;
 }
 
 /* represents DockedStackDividerController */
 message DockedStackDividerControllerProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional bool minimized_dock = 1;
+    optional bool minimized_dock = 1;
 }
 
 /* represents PinnedStackController */
 message PinnedStackControllerProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional .android.graphics.RectProto default_bounds = 1;
-  optional .android.graphics.RectProto movement_bounds = 2;
+    optional .android.graphics.RectProto default_bounds = 1;
+    optional .android.graphics.RectProto movement_bounds = 2;
 }
 
 /* represents TaskStack */
 message StackProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional WindowContainerProto window_container = 1;
-  optional int32 id = 2;
-  repeated TaskProto tasks = 3;
-  optional bool fills_parent = 4;
-  optional .android.graphics.RectProto bounds = 5;
-  optional bool animation_background_surface_is_dimming = 6;
-  optional bool defer_removal = 7;
-  optional float minimize_amount = 8;
-  optional bool adjusted_for_ime = 9;
-  optional float adjust_ime_amount = 10;
-  optional float adjust_divider_amount = 11;
-  optional .android.graphics.RectProto adjusted_bounds = 12;
-  optional bool animating_bounds = 13;
+    optional WindowContainerProto window_container = 1;
+    optional int32 id = 2;
+    repeated TaskProto tasks = 3;
+    optional bool fills_parent = 4;
+    optional .android.graphics.RectProto bounds = 5;
+    optional bool animation_background_surface_is_dimming = 6;
+    optional bool defer_removal = 7;
+    optional float minimize_amount = 8;
+    optional bool adjusted_for_ime = 9;
+    optional float adjust_ime_amount = 10;
+    optional float adjust_divider_amount = 11;
+    optional .android.graphics.RectProto adjusted_bounds = 12;
+    optional bool animating_bounds = 13;
 }
 
 /* represents Task */
 message TaskProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional WindowContainerProto window_container = 1;
-  optional int32 id = 2;
-  repeated AppWindowTokenProto app_window_tokens = 3;
-  optional bool fills_parent = 4;
-  optional .android.graphics.RectProto bounds = 5;
-  optional .android.graphics.RectProto temp_inset_bounds = 6;
-  optional bool defer_removal = 7;
+    optional WindowContainerProto window_container = 1;
+    optional int32 id = 2;
+    repeated AppWindowTokenProto app_window_tokens = 3;
+    optional bool fills_parent = 4;
+    optional .android.graphics.RectProto bounds = 5;
+    optional .android.graphics.RectProto temp_inset_bounds = 6;
+    optional bool defer_removal = 7;
 }
 
 /* represents AppWindowToken */
 message AppWindowTokenProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  /* obtained from ActivityRecord */
-  optional string name = 1 [ (.android.privacy).dest = DEST_EXPLICIT ];
-  optional WindowTokenProto window_token = 2;
-  optional bool last_surface_showing = 3;
-  optional bool is_waiting_for_transition_start =  4;
-  optional bool is_really_animating = 5;
-  optional AppWindowThumbnailProto thumbnail = 6;
-  optional bool fills_parent = 7;
-  optional bool app_stopped = 8;
-  optional bool hidden_requested = 9;
-  optional bool client_hidden = 10;
-  optional bool defer_hiding_client = 11;
-  optional bool reported_drawn = 12;
-  optional bool reported_visible = 13;
-  optional int32 num_interesting_windows = 14;
-  optional int32 num_drawn_windows = 15;
-  optional bool all_drawn = 16;
-  optional bool last_all_drawn = 17;
-  optional bool removed = 18;
-  optional IdentifierProto starting_window = 19;
-  optional bool starting_displayed = 20;
-  optional bool starting_moved = 21;
-  optional bool hidden_set_from_transferred_starting_window = 22;
-  repeated .android.graphics.RectProto frozen_bounds = 23;
+    /* obtained from ActivityRecord */
+    optional string name = 1 [ (.android.privacy).dest = DEST_EXPLICIT ];
+    optional WindowTokenProto window_token = 2;
+    optional bool last_surface_showing = 3;
+    optional bool is_waiting_for_transition_start = 4;
+    optional bool is_really_animating = 5;
+    optional AppWindowThumbnailProto thumbnail = 6;
+    optional bool fills_parent = 7;
+    optional bool app_stopped = 8;
+    optional bool hidden_requested = 9;
+    optional bool client_hidden = 10;
+    optional bool defer_hiding_client = 11;
+    optional bool reported_drawn = 12;
+    optional bool reported_visible = 13;
+    optional int32 num_interesting_windows = 14;
+    optional int32 num_drawn_windows = 15;
+    optional bool all_drawn = 16;
+    optional bool last_all_drawn = 17;
+    optional bool removed = 18;
+    optional IdentifierProto starting_window = 19;
+    optional bool starting_displayed = 20;
+    optional bool starting_moved = 21;
+    optional bool hidden_set_from_transferred_starting_window = 22;
+    repeated .android.graphics.RectProto frozen_bounds = 23;
 }
 
 /* represents WindowToken */
 message WindowTokenProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional WindowContainerProto window_container = 1;
-  optional int32 hash_code = 2;
-  repeated WindowStateProto windows = 3;
-  optional bool hidden = 4;
-  optional bool waiting_to_show = 5;
-  optional bool paused = 6;
+    optional WindowContainerProto window_container = 1;
+    optional int32 hash_code = 2;
+    repeated WindowStateProto windows = 3;
+    optional bool hidden = 4;
+    optional bool waiting_to_show = 5;
+    optional bool paused = 6;
 }
 
 /* represents WindowState */
 message WindowStateProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional WindowContainerProto window_container = 1;
-  optional IdentifierProto identifier = 2;
-  optional int32 display_id = 3;
-  optional int32 stack_id = 4;
-  optional .android.view.WindowLayoutParamsProto attributes = 5;
-  optional .android.graphics.RectProto given_content_insets = 6;
-  optional .android.graphics.RectProto frame = 7;
-  optional .android.graphics.RectProto containing_frame = 8;
-  optional .android.graphics.RectProto parent_frame = 9;
-  optional .android.graphics.RectProto content_frame = 10;
-  optional .android.graphics.RectProto content_insets = 11;
-  optional .android.graphics.RectProto surface_insets = 12;
-  optional WindowStateAnimatorProto animator = 13;
-  optional bool animating_exit = 14;
-  repeated WindowStateProto child_windows = 15;
-  optional .android.graphics.RectProto surface_position = 16;
-  optional int32 requested_width = 18;
-  optional int32 requested_height = 19;
-  optional int32 view_visibility = 20;
-  optional int32 system_ui_visibility = 21;
-  optional bool has_surface = 22;
-  optional bool is_ready_for_display = 23;
-  optional .android.graphics.RectProto display_frame = 24;
-  optional .android.graphics.RectProto overscan_frame = 25;
-  optional .android.graphics.RectProto visible_frame = 26;
-  optional .android.graphics.RectProto decor_frame = 27;
-  optional .android.graphics.RectProto outset_frame = 28;
-  optional .android.graphics.RectProto overscan_insets = 29;
-  optional .android.graphics.RectProto visible_insets = 30;
-  optional .android.graphics.RectProto stable_insets = 31;
-  optional .android.graphics.RectProto outsets = 32;
-  optional .android.view.DisplayCutoutProto cutout = 33;
-  optional bool remove_on_exit = 34;
-  optional bool destroying = 35;
-  optional bool removed = 36;
-  optional bool is_on_screen = 37;
-  optional bool is_visible = 38;
+    optional WindowContainerProto window_container = 1;
+    optional IdentifierProto identifier = 2;
+    optional int32 display_id = 3;
+    optional int32 stack_id = 4;
+    optional .android.view.WindowLayoutParamsProto attributes = 5;
+    optional .android.graphics.RectProto given_content_insets = 6;
+    optional .android.graphics.RectProto frame = 7;
+    optional .android.graphics.RectProto containing_frame = 8;
+    optional .android.graphics.RectProto parent_frame = 9;
+    optional .android.graphics.RectProto content_frame = 10;
+    optional .android.graphics.RectProto content_insets = 11;
+    optional .android.graphics.RectProto surface_insets = 12;
+    optional WindowStateAnimatorProto animator = 13;
+    optional bool animating_exit = 14;
+    repeated WindowStateProto child_windows = 15;
+    optional .android.graphics.RectProto surface_position = 16;
+    optional int32 requested_width = 18;
+    optional int32 requested_height = 19;
+    optional int32 view_visibility = 20;
+    optional int32 system_ui_visibility = 21;
+    optional bool has_surface = 22;
+    optional bool is_ready_for_display = 23;
+    optional .android.graphics.RectProto display_frame = 24;
+    optional .android.graphics.RectProto overscan_frame = 25;
+    optional .android.graphics.RectProto visible_frame = 26;
+    optional .android.graphics.RectProto decor_frame = 27;
+    optional .android.graphics.RectProto outset_frame = 28;
+    optional .android.graphics.RectProto overscan_insets = 29;
+    optional .android.graphics.RectProto visible_insets = 30;
+    optional .android.graphics.RectProto stable_insets = 31;
+    optional .android.graphics.RectProto outsets = 32;
+    optional .android.view.DisplayCutoutProto cutout = 33;
+    optional bool remove_on_exit = 34;
+    optional bool destroying = 35;
+    optional bool removed = 36;
+    optional bool is_on_screen = 37;
+    optional bool is_visible = 38;
 }
 
 message IdentifierProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional int32 hash_code = 1;
-  optional int32 user_id = 2;
-  optional string title = 3  [ (.android.privacy).dest = DEST_EXPLICIT ];
+    optional int32 hash_code = 1;
+    optional int32 user_id = 2;
+    optional string title = 3 [ (.android.privacy).dest = DEST_EXPLICIT ];
 }
 
 /* represents WindowStateAnimator */
 message WindowStateAnimatorProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional .android.graphics.RectProto last_clip_rect = 1;
-  optional WindowSurfaceControllerProto surface = 2;
-  enum DrawState {
-    NO_SURFACE = 0;
-    DRAW_PENDING = 1;
-    COMMIT_DRAW_PENDING = 2;
-    READY_TO_SHOW = 3;
-    HAS_DRAWN = 4;
-  }
-  optional DrawState draw_state = 3;
-  optional .android.graphics.RectProto system_decor_rect = 4;
+    optional .android.graphics.RectProto last_clip_rect = 1;
+    optional WindowSurfaceControllerProto surface = 2;
+    enum DrawState {
+        NO_SURFACE = 0;
+        DRAW_PENDING = 1;
+        COMMIT_DRAW_PENDING = 2;
+        READY_TO_SHOW = 3;
+        HAS_DRAWN = 4;
+    }
+    optional DrawState draw_state = 3;
+    optional .android.graphics.RectProto system_decor_rect = 4;
 }
 
 /* represents WindowSurfaceController */
 message WindowSurfaceControllerProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional bool shown = 1;
-  optional int32 layer = 2;
+    optional bool shown = 1;
+    optional int32 layer = 2;
 }
 
 /* represents ScreenRotationAnimation */
 message ScreenRotationAnimationProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional bool started = 1;
-  optional bool animation_running = 2;
+    optional bool started = 1;
+    optional bool animation_running = 2;
 }
 
 /* represents WindowContainer */
 message WindowContainerProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional ConfigurationContainerProto configuration_container = 1;
-  optional int32 orientation = 2;
-  optional bool visible = 3;
-  optional SurfaceAnimatorProto surface_animator = 4;
+    optional ConfigurationContainerProto configuration_container = 1;
+    optional int32 orientation = 2;
+    optional bool visible = 3;
+    optional SurfaceAnimatorProto surface_animator = 4;
 }
 
 /* represents ConfigurationContainer */
 message ConfigurationContainerProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional .android.content.ConfigurationProto override_configuration = 1;
-  optional .android.content.ConfigurationProto full_configuration = 2;
-  optional .android.content.ConfigurationProto merged_override_configuration = 3;
+    optional .android.content.ConfigurationProto override_configuration = 1;
+    optional .android.content.ConfigurationProto full_configuration = 2;
+    optional .android.content.ConfigurationProto merged_override_configuration = 3;
 }
diff --git a/core/proto/android/service/appwidget.proto b/core/proto/android/service/appwidget.proto
index 3f46d2b..cd7173a 100644
--- a/core/proto/android/service/appwidget.proto
+++ b/core/proto/android/service/appwidget.proto
@@ -22,18 +22,18 @@
 
 // represents the object holding the dump info of the app widget service
 message AppWidgetServiceDumpProto {
-  repeated WidgetProto widgets = 1; // the array of bound widgets
+    repeated WidgetProto widgets = 1; // the array of bound widgets
 }
 
 // represents a bound widget
 message WidgetProto {
-  optional bool isCrossProfile = 1; // true if host and provider belong to diff users
-  optional bool isHostStopped = 2; // true if host has not called startListening yet
-  optional string hostPackage = 3;
-  optional string providerPackage = 4;
-  optional string providerClass = 5;
-  optional int32 minWidth = 6;
-  optional int32 minHeight = 7;
-  optional int32 maxWidth = 8;
-  optional int32 maxHeight = 9;
+    optional bool isCrossProfile = 1; // true if host and provider belong to diff users
+    optional bool isHostStopped = 2; // true if host has not called startListening yet
+    optional string hostPackage = 3;
+    optional string providerPackage = 4;
+    optional string providerClass = 5;
+    optional int32 minWidth = 6;
+    optional int32 minHeight = 7;
+    optional int32 maxWidth = 8;
+    optional int32 maxHeight = 9;
 }
diff --git a/core/proto/android/service/batterystats.proto b/core/proto/android/service/batterystats.proto
index e31e7f3..5586263 100644
--- a/core/proto/android/service/batterystats.proto
+++ b/core/proto/android/service/batterystats.proto
@@ -24,7 +24,7 @@
 import "frameworks/base/libs/incident/proto/android/privacy.proto";
 
 message BatteryStatsServiceDumpProto {
-  option (android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional android.os.BatteryStatsProto batterystats = 1;
+    optional android.os.BatteryStatsProto batterystats = 1;
 }
diff --git a/core/proto/android/service/network_watchlist.proto b/core/proto/android/service/network_watchlist.proto
index fb03b93..66d79bdb 100644
--- a/core/proto/android/service/network_watchlist.proto
+++ b/core/proto/android/service/network_watchlist.proto
@@ -23,14 +23,14 @@
 // generate network watchlist report.
 message NetworkWatchlistReportProto {
 
-  optional int32 report_version = 1;
+    optional int32 report_version = 1;
 
-  optional string watchlist_config_hash = 2;
+    optional string watchlist_config_hash = 2;
 
-  repeated NetworkWatchlistAppResultProto app_result = 3;
+    repeated NetworkWatchlistAppResultProto app_result = 3;
 }
 
 message NetworkWatchlistAppResultProto {
-  optional string app_digest = 1;
-  optional bool encoded_result = 2;
+    optional string app_digest = 1;
+    optional bool encoded_result = 2;
 }
diff --git a/core/proto/android/service/usb.proto b/core/proto/android/service/usb.proto
index 8240d8a..c363710 100644
--- a/core/proto/android/service/usb.proto
+++ b/core/proto/android/service/usb.proto
@@ -88,7 +88,7 @@
     option (android.msg_privacy).dest = DEST_AUTOMATIC;
 
     optional bool connected_to_adb = 1;
-    optional string last_key_recevied = 2 [ (android.privacy).dest = DEST_EXPLICIT ];
+    optional string last_key_received = 2 [ (android.privacy).dest = DEST_EXPLICIT ];
     optional string user_keys = 3 [ (android.privacy).dest = DEST_LOCAL ];
     optional string system_keys = 4 [ (android.privacy).dest = DEST_LOCAL ];
 }
@@ -342,4 +342,4 @@
     optional string manufacturer = 1;
     optional string model = 2;
     optional string version = 3;
-}
\ No newline at end of file
+}
diff --git a/core/proto/android/view/displaycutout.proto b/core/proto/android/view/displaycutout.proto
index ee258b7..f4744da 100644
--- a/core/proto/android/view/displaycutout.proto
+++ b/core/proto/android/view/displaycutout.proto
@@ -23,8 +23,8 @@
 option java_multiple_files = true;
 
 message DisplayCutoutProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional .android.graphics.RectProto insets = 1;
-  optional .android.graphics.RectProto bounds = 2;
+    optional .android.graphics.RectProto insets = 1;
+    optional .android.graphics.RectProto bounds = 2;
 }
diff --git a/core/proto/android/view/displayinfo.proto b/core/proto/android/view/displayinfo.proto
index 2a03050..8583955 100644
--- a/core/proto/android/view/displayinfo.proto
+++ b/core/proto/android/view/displayinfo.proto
@@ -23,11 +23,11 @@
 
 /* represents DisplayInfo */
 message DisplayInfoProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional int32 logical_width = 1;
-  optional int32 logical_height = 2;
-  optional int32 app_width = 3;
-  optional int32 app_height = 4;
-  optional string name = 5 [ (.android.privacy).dest = DEST_EXPLICIT ];
+    optional int32 logical_width = 1;
+    optional int32 logical_height = 2;
+    optional int32 app_width = 3;
+    optional int32 app_height = 4;
+    optional string name = 5 [ (.android.privacy).dest = DEST_EXPLICIT ];
 }
diff --git a/core/proto/android/view/remote_animation_target.proto b/core/proto/android/view/remote_animation_target.proto
index d5da0a9..9139f25 100644
--- a/core/proto/android/view/remote_animation_target.proto
+++ b/core/proto/android/view/remote_animation_target.proto
@@ -28,16 +28,16 @@
 
 /** Proto representation for RemoteAnimationTarget.java class. */
 message RemoteAnimationTargetProto {
-  option (android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional int32 task_id = 1;
-  optional int32 mode = 2;
-  optional .android.view.SurfaceControlProto leash = 3;
-  optional bool is_translucent = 4;
-  optional .android.graphics.RectProto clip_rect = 5;
-  optional .android.graphics.RectProto contentInsets = 6;
-  optional int32 prefix_order_index = 7;
-  optional .android.graphics.PointProto position = 8;
-  optional .android.graphics.RectProto source_container_bounds = 9;
-  optional .android.app.WindowConfigurationProto window_configuration = 10;
+    optional int32 task_id = 1;
+    optional int32 mode = 2;
+    optional .android.view.SurfaceControlProto leash = 3;
+    optional bool is_translucent = 4;
+    optional .android.graphics.RectProto clip_rect = 5;
+    optional .android.graphics.RectProto contentInsets = 6;
+    optional int32 prefix_order_index = 7;
+    optional .android.graphics.PointProto position = 8;
+    optional .android.graphics.RectProto source_container_bounds = 9;
+    optional .android.app.WindowConfigurationProto window_configuration = 10;
 }
diff --git a/core/proto/android/view/surface.proto b/core/proto/android/view/surface.proto
index 8f5f695..e20b094 100644
--- a/core/proto/android/view/surface.proto
+++ b/core/proto/android/view/surface.proto
@@ -19,10 +19,10 @@
 option java_multiple_files = true;
 
 message SurfaceProto {
-  enum Rotation {
-    ROTATION_0 = 0;
-    ROTATION_90 = 1;
-    ROTATION_180 = 2;
-    ROTATION_270 = 3;
-  }
+    enum Rotation {
+        ROTATION_0 = 0;
+        ROTATION_90 = 1;
+        ROTATION_180 = 2;
+        ROTATION_270 = 3;
+    }
 }
diff --git a/core/proto/android/view/surfacecontrol.proto b/core/proto/android/view/surfacecontrol.proto
index 665d688..8a252be 100644
--- a/core/proto/android/view/surfacecontrol.proto
+++ b/core/proto/android/view/surfacecontrol.proto
@@ -25,8 +25,8 @@
  * Represents a {@link android.view.SurfaceControl} object.
  */
 message SurfaceControlProto {
-  option (android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional int32 hash_code = 1;
-  optional string name = 2 [ (android.privacy).dest = DEST_EXPLICIT ];
+    optional int32 hash_code = 1;
+    optional string name = 2 [ (android.privacy).dest = DEST_EXPLICIT ];
 }
diff --git a/core/proto/android/view/windowlayoutparams.proto b/core/proto/android/view/windowlayoutparams.proto
index 0362ab1..586321d 100644
--- a/core/proto/android/view/windowlayoutparams.proto
+++ b/core/proto/android/view/windowlayoutparams.proto
@@ -25,43 +25,47 @@
 
 /* represents WindowManager.LayoutParams */
 message WindowLayoutParamsProto {
-  option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
-  optional int32 type = 1;
-  optional int32 x = 2;
-  optional int32 y = 3;
-  optional int32 width = 4;
-  optional int32 height = 5;
-  optional float horizontal_margin = 6;
-  optional float vertical_margin = 7;
-  optional int32 gravity = 8;
-  optional int32 soft_input_mode = 9;
-  optional .android.graphics.PixelFormatProto.Format format = 10;
-  optional int32 window_animations = 11;
-  optional float alpha = 12;
-  optional float screen_brightness = 13;
-  optional float button_brightness = 14;
-  enum RotationAnimation {
-    ROTATION_ANIMATION_UNSPECIFIED = -1;
-    ROTATION_ANIMATION_CROSSFADE = 1;
-    ROTATION_ANIMATION_JUMPCUT = 2;
-    ROTATION_ANIMATION_SEAMLESS = 3;
-  }
-  optional RotationAnimation rotation_animation = 15;
-  optional float preferred_refresh_rate = 16;
-  optional int32 preferred_display_mode_id = 17;
-  optional bool has_system_ui_listeners = 18;
-  optional uint32 input_feature_flags = 19;
-  optional int64 user_activity_timeout = 20;
-  enum NeedsMenuState {
-    NEEDS_MENU_UNSET = 0;
-    NEEDS_MENU_SET_TRUE = 1;
-    NEEDS_MENU_SET_FALSE = 2;
-  }
-  optional NeedsMenuState needs_menu_key = 22;
-  optional .android.view.DisplayProto.ColorMode color_mode = 23;
-  optional uint32 flags = 24;
-  optional uint32 private_flags = 26;
-  optional uint32 system_ui_visibility_flags = 27;
-  optional uint32 subtree_system_ui_visibility_flags = 28;
+    optional int32 type = 1;
+    optional int32 x = 2;
+    optional int32 y = 3;
+    optional int32 width = 4;
+    optional int32 height = 5;
+    optional float horizontal_margin = 6;
+    optional float vertical_margin = 7;
+    optional int32 gravity = 8;
+    optional int32 soft_input_mode = 9;
+    optional .android.graphics.PixelFormatProto.Format format = 10;
+    optional int32 window_animations = 11;
+    optional float alpha = 12;
+    optional float screen_brightness = 13;
+    optional float button_brightness = 14;
+
+    enum RotationAnimation {
+        ROTATION_ANIMATION_UNSPECIFIED = -1;
+        ROTATION_ANIMATION_CROSSFADE = 1;
+        ROTATION_ANIMATION_JUMPCUT = 2;
+        ROTATION_ANIMATION_SEAMLESS = 3;
+    }
+    optional RotationAnimation rotation_animation = 15;
+
+    optional float preferred_refresh_rate = 16;
+    optional int32 preferred_display_mode_id = 17;
+    optional bool has_system_ui_listeners = 18;
+    optional uint32 input_feature_flags = 19;
+    optional int64 user_activity_timeout = 20;
+
+    enum NeedsMenuState {
+        NEEDS_MENU_UNSET = 0;
+        NEEDS_MENU_SET_TRUE = 1;
+        NEEDS_MENU_SET_FALSE = 2;
+    }
+    optional NeedsMenuState needs_menu_key = 22;
+
+    optional .android.view.DisplayProto.ColorMode color_mode = 23;
+    optional uint32 flags = 24;
+    optional uint32 private_flags = 26;
+    optional uint32 system_ui_visibility_flags = 27;
+    optional uint32 subtree_system_ui_visibility_flags = 28;
 }
diff --git a/core/res/res/layout/language_picker_section_header.xml b/core/res/res/layout/language_picker_section_header.xml
index 6cbd7c3..4fa4d9b 100644
--- a/core/res/res/layout/language_picker_section_header.xml
+++ b/core/res/res/layout/language_picker_section_header.xml
@@ -20,8 +20,8 @@
           android:layout_width="match_parent"
           android:layout_height="36dp"
           android:gravity="center_vertical"
-          android:paddingStart="18dp"
-          android:paddingEnd="18dp"
+          android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+          android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
           android:textColor="?android:attr/colorAccent"
           android:textStyle="bold"
           tools:text="@string/language_picker_section_all"/>
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index fe34d98..21c10ce 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -3089,6 +3089,9 @@
              See {@link android.view.View#setAccessibilityPaneTitle(CharSequence)} -->
         <attr name="accessibilityPaneTitle" format="string" />
 
+        <!-- Whether or not this view is a heading for accessibility purposes. -->
+        <attr name="accessibilityHeading" format="boolean"/>
+
         <!-- Sets the color of the spot shadow that is drawn when the view has a positive Z or
              elevation value.
              <p>
@@ -4956,8 +4959,6 @@
             <!-- Justification by stretching word spacing. -->
             <enum name="inter_word" value = "1" />
         </attr>
-        <!-- Whether or not this view is a heading for accessibility purposes. -->
-        <attr name="accessibilityHeading" format="boolean"/>
     </declare-styleable>
     <declare-styleable name="TextViewAppearance">
         <!-- Base text color, typeface, size, and style. -->
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index bd824de..04f4d6e 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -4704,11 +4704,13 @@
     <string name="locale_search_menu">Search</string>
 
     <!-- Title of the dialog that is shown when the user tries to launch a suspended application [CHAR LIMIT=30] -->
-    <string name="app_suspended_title">Action not allowed</string>
+    <string name="app_suspended_title">Can\u2019t open app</string>
     <!-- Default message shown in the dialog that is shown when the user tries to launch a suspended application [CHAR LIMIT=NONE] -->
-    <string name="app_suspended_default_message">The application <xliff:g id="app_name" example="GMail">%1$s</xliff:g> is currently disabled.</string>
+    <string name="app_suspended_default_message">
+        The app <xliff:g id="app_name" example="Gmail">%1$s</xliff:g> isn\u2019t available right now. This is managed by <xliff:g id="app_name" example="Settings">%2$s</xliff:g>.
+    </string>
     <!-- Title of the button to show users more details about why the app has been suspended [CHAR LIMIT=50]-->
-    <string name="app_suspended_more_details">More details</string>
+    <string name="app_suspended_more_details">Learn more</string>
 
     <!-- Title of a dialog. The string is asking if the user wants to turn on their work profile, which contains work apps that are managed by their employer. "Work" is an adjective. [CHAR LIMIT=30] -->
     <string name="work_mode_off_title">Turn on work profile?</string>
diff --git a/core/res/res/xml/default_zen_mode_config.xml b/core/res/res/xml/default_zen_mode_config.xml
index f1b61a7..dce8a65 100644
--- a/core/res/res/xml/default_zen_mode_config.xml
+++ b/core/res/res/xml/default_zen_mode_config.xml
@@ -18,7 +18,7 @@
 -->
 
 <!-- Default configuration for zen mode.  See android.service.notification.ZenModeConfig. -->
-<zen version="6">
+<zen version="7">
     <allow alarms="true" media="true" system="false" calls="false" messages="false" reminders="false"
            events="false" />
     <!-- all visual effects that exist as of P -->
diff --git a/keystore/java/android/security/keystore/KeyGenParameterSpec.java b/keystore/java/android/security/keystore/KeyGenParameterSpec.java
index 58332a2..b2e0f67 100644
--- a/keystore/java/android/security/keystore/KeyGenParameterSpec.java
+++ b/keystore/java/android/security/keystore/KeyGenParameterSpec.java
@@ -595,6 +595,14 @@
     /**
      * Returns {@code true} if the key is authorized to be used only if a test of user presence has
      * been performed between the {@code Signature.initSign()} and {@code Signature.sign()} calls.
+     * It requires that the KeyStore implementation have a direct way to validate the user presence
+     * for example a KeyStore hardware backed strongbox can use a button press that is observable
+     * in hardware. A test for user presence is tangential to authentication. The test can be part
+     * of an authentication step as long as this step can be validated by the hardware protecting
+     * the key and cannot be spoofed. For example, a physical button press can be used as a test of
+     * user presence if the other pins connected to the button are not able to simulate a button
+     * press. There must be no way for the primary processor to fake a button press, or that
+     * button must not be used as a test of user presence.
      */
     public boolean isUserPresenceRequired() {
         return mUserPresenceRequired;
@@ -1181,6 +1189,14 @@
         /**
          * Sets whether a test of user presence is required to be performed between the
          * {@code Signature.initSign()} and {@code Signature.sign()} method calls.
+         * It requires that the KeyStore implementation have a direct way to validate the user
+         * presence for example a KeyStore hardware backed strongbox can use a button press that
+         * is observable in hardware. A test for user presence is tangential to authentication. The
+         * test can be part of an authentication step as long as this step can be validated by the
+         * hardware protecting the key and cannot be spoofed. For example, a physical button press
+         * can be used as a test of user presence if the other pins connected to the button are not
+         * able to simulate a button press.There must be no way for the primary processor to fake a
+         * button press, or that button must not be used as a test of user presence.
          */
         @NonNull
         public Builder setUserPresenceRequired(boolean required) {
diff --git a/keystore/java/android/security/keystore/KeyProtection.java b/keystore/java/android/security/keystore/KeyProtection.java
index 92bee8d..fdcad85 100644
--- a/keystore/java/android/security/keystore/KeyProtection.java
+++ b/keystore/java/android/security/keystore/KeyProtection.java
@@ -448,7 +448,12 @@
      * been performed between the {@code Signature.initSign()} and {@code Signature.sign()} calls.
      * It requires that the KeyStore implementation have a direct way to validate the user presence
      * for example a KeyStore hardware backed strongbox can use a button press that is observable
-     * in hardware.
+     * in hardware. A test for user presence is tangential to authentication. The test can be part
+     * of an authentication step as long as this step can be validated by the hardware protecting
+     * the key and cannot be spoofed. For example, a physical button press can be used as a test of
+     * user presence if the other pins connected to the button are not able to simulate a button
+     * press. There must be no way for the primary processor to fake a button press, or that
+     * button must not be used as a test of user presence.
      */
     public boolean isUserPresenceRequired() {
         return mUserPresenceRequred;
@@ -845,7 +850,15 @@
 
         /**
          * Sets whether a test of user presence is required to be performed between the
-         * {@code Signature.initSign()} and {@code Signature.sign()} method calls.
+         * {@code Signature.initSign()} and {@code Signature.sign()} method calls. It requires that
+         * the KeyStore implementation have a direct way to validate the user presence for example
+         * a KeyStore hardware backed strongbox can use a button press that is observable in
+         * hardware. A test for user presence is tangential to authentication. The test can be part
+         * of an authentication step as long as this step can be validated by the hardware
+         * protecting the key and cannot be spoofed. For example, a physical button press can be
+         * used as a test of user presence if the other pins connected to the button are not able
+         * to simulate a button press. There must be no way for the primary processor to fake a
+         * button press, or that button must not be used as a test of user presence.
          */
         @NonNull
         public Builder setUserPresenceRequired(boolean required) {
diff --git a/media/java/android/media/AudioPlaybackConfiguration.java b/media/java/android/media/AudioPlaybackConfiguration.java
index 8a36f91..7dfdb20 100644
--- a/media/java/android/media/AudioPlaybackConfiguration.java
+++ b/media/java/android/media/AudioPlaybackConfiguration.java
@@ -43,6 +43,8 @@
     /** @hide */
     public static final int PLAYER_PIID_INVALID = -1;
     /** @hide */
+    public static final int PLAYER_PIID_UNASSIGNED = 0;
+    /** @hide */
     public static final int PLAYER_UPID_INVALID = -1;
 
     // information about the implementation
diff --git a/media/java/android/media/MediaCodecInfo.java b/media/java/android/media/MediaCodecInfo.java
index c29300d..2cb58d0 100644
--- a/media/java/android/media/MediaCodecInfo.java
+++ b/media/java/android/media/MediaCodecInfo.java
@@ -909,7 +909,8 @@
             if (mMime.toLowerCase().startsWith("audio/")) {
                 mAudioCaps = AudioCapabilities.create(info, this);
                 mAudioCaps.getDefaultFormat(mDefaultFormat);
-            } else if (mMime.toLowerCase().startsWith("video/")) {
+            } else if (mMime.toLowerCase().startsWith("video/")
+                    || mMime.equalsIgnoreCase(MediaFormat.MIMETYPE_IMAGE_ANDROID_HEIC)) {
                 mVideoCaps = VideoCapabilities.create(info, this);
             }
             if (encoder) {
diff --git a/media/java/android/media/PlayerBase.java b/media/java/android/media/PlayerBase.java
index 80049ba5..7c6367e 100644
--- a/media/java/android/media/PlayerBase.java
+++ b/media/java/android/media/PlayerBase.java
@@ -31,6 +31,7 @@
 import android.os.ServiceManager;
 import android.util.Log;
 
+import com.android.internal.annotations.GuardedBy;
 import com.android.internal.app.IAppOpsCallback;
 import com.android.internal.app.IAppOpsService;
 
@@ -58,20 +59,29 @@
     protected float mRightVolume = 1.0f;
     protected float mAuxEffectSendLevel = 0.0f;
 
-    // for AppOps
-    private IAppOpsService mAppOps; // may be null
-    private IAppOpsCallback mAppOpsCallback;
-    private boolean mHasAppOpsPlayAudio = true; // sync'd on mLock
+    // NEVER call into AudioService (see getService()) with mLock held: PlayerBase can run in
+    // the same process as AudioService, which can synchronously call back into this class,
+    // causing deadlocks between the two
     private final Object mLock = new Object();
 
+    // for AppOps
+    private @Nullable IAppOpsService mAppOps;
+    private IAppOpsCallback mAppOpsCallback;
+    @GuardedBy("mLock")
+    private boolean mHasAppOpsPlayAudio = true;
+
     private final int mImplType;
     // uniquely identifies the Player Interface throughout the system (P I Id)
-    private int mPlayerIId;
+    private int mPlayerIId = AudioPlaybackConfiguration.PLAYER_PIID_UNASSIGNED;
 
-    private int mState; // sync'd on mLock
-    private int mStartDelayMs = 0; // sync'd on mLock
-    private float mPanMultiplierL = 1.0f; // sync'd on mLock
-    private float mPanMultiplierR = 1.0f; // sync'd on mLock
+    @GuardedBy("mLock")
+    private int mState;
+    @GuardedBy("mLock")
+    private int mStartDelayMs = 0;
+    @GuardedBy("mLock")
+    private float mPanMultiplierL = 1.0f;
+    @GuardedBy("mLock")
+    private float mPanMultiplierR = 1.0f;
 
     /**
      * Constructor. Must be given audio attributes, as they are required for AppOps.
@@ -134,16 +144,24 @@
         }
     }
 
+    private void updateState(int state) {
+        final int piid;
+        synchronized (mLock) {
+            mState = state;
+            piid = mPlayerIId;
+        }
+        try {
+            getService().playerEvent(piid, state);
+        } catch (RemoteException e) {
+            Log.e(TAG, "Error talking to audio service, "
+                    + AudioPlaybackConfiguration.toLogFriendlyPlayerState(state)
+                    + " state will not be tracked for piid=" + piid, e);
+        }
+    }
+
     void baseStart() {
         if (DEBUG) { Log.v(TAG, "baseStart() piid=" + mPlayerIId); }
-        try {
-            synchronized (mLock) {
-                mState = AudioPlaybackConfiguration.PLAYER_STATE_STARTED;
-                getService().playerEvent(mPlayerIId, mState);
-            }
-        } catch (RemoteException e) {
-            Log.e(TAG, "Error talking to audio service, STARTED state will not be tracked", e);
-        }
+        updateState(AudioPlaybackConfiguration.PLAYER_STATE_STARTED);
         synchronized (mLock) {
             if (isRestricted_sync()) {
                 playerSetVolume(true/*muting*/,0, 0);
@@ -165,26 +183,12 @@
 
     void basePause() {
         if (DEBUG) { Log.v(TAG, "basePause() piid=" + mPlayerIId); }
-        try {
-            synchronized (mLock) {
-                mState = AudioPlaybackConfiguration.PLAYER_STATE_PAUSED;
-                getService().playerEvent(mPlayerIId, mState);
-            }
-        } catch (RemoteException e) {
-            Log.e(TAG, "Error talking to audio service, PAUSED state will not be tracked", e);
-        }
+        updateState(AudioPlaybackConfiguration.PLAYER_STATE_PAUSED);
     }
 
     void baseStop() {
         if (DEBUG) { Log.v(TAG, "baseStop() piid=" + mPlayerIId); }
-        try {
-            synchronized (mLock) {
-                mState = AudioPlaybackConfiguration.PLAYER_STATE_STOPPED;
-                getService().playerEvent(mPlayerIId, mState);
-            }
-        } catch (RemoteException e) {
-            Log.e(TAG, "Error talking to audio service, STOPPED state will not be tracked", e);
-        }
+        updateState(AudioPlaybackConfiguration.PLAYER_STATE_STOPPED);
     }
 
     void baseSetPan(float pan) {
@@ -228,12 +232,16 @@
      */
     void baseRelease() {
         if (DEBUG) { Log.v(TAG, "baseRelease() piid=" + mPlayerIId + " state=" + mState); }
+        boolean releasePlayer = false;
+        synchronized (mLock) {
+            if (mState != AudioPlaybackConfiguration.PLAYER_STATE_RELEASED) {
+                releasePlayer = true;
+                mState = AudioPlaybackConfiguration.PLAYER_STATE_RELEASED;
+            }
+        }
         try {
-            synchronized (mLock) {
-                if (mState != AudioPlaybackConfiguration.PLAYER_STATE_RELEASED) {
-                    getService().releasePlayer(mPlayerIId);
-                    mState = AudioPlaybackConfiguration.PLAYER_STATE_RELEASED;
-                }
+            if (releasePlayer) {
+                getService().releasePlayer(mPlayerIId);
             }
         } catch (RemoteException e) {
             Log.e(TAG, "Error talking to audio service, the player will still be tracked", e);
diff --git a/media/java/android/media/session/MediaSessionManager.java b/media/java/android/media/session/MediaSessionManager.java
index fbc1438..f358103 100644
--- a/media/java/android/media/session/MediaSessionManager.java
+++ b/media/java/android/media/session/MediaSessionManager.java
@@ -354,7 +354,10 @@
      * @return {@code true} if the remote user is trusted and its package name matches with the UID.
      *            {@code false} otherwise.
      */
-    public boolean isTrustedForMediaControl(RemoteUserInfo userInfo) {
+    public boolean isTrustedForMediaControl(@NonNull RemoteUserInfo userInfo) {
+        if (userInfo == null) {
+            throw new IllegalArgumentException("userInfo may not be null");
+        }
         if (userInfo.getPackageName() == null) {
             return false;
         }
diff --git a/packages/SettingsLib/src/com/android/settingslib/users/UserManagerHelper.java b/packages/SettingsLib/src/com/android/settingslib/users/UserManagerHelper.java
index c4ca339..113256f 100644
--- a/packages/SettingsLib/src/com/android/settingslib/users/UserManagerHelper.java
+++ b/packages/SettingsLib/src/com/android/settingslib/users/UserManagerHelper.java
@@ -41,6 +41,7 @@
     private static final String TAG = "UserManagerHelper";
     private final Context mContext;
     private final UserManager mUserManager;
+    private final ActivityManager mActivityManager;
     private OnUsersUpdateListener mUpdateListener;
     private final BroadcastReceiver mUserChangeReceiver = new BroadcastReceiver() {
         @Override
@@ -52,6 +53,7 @@
     public UserManagerHelper(Context context) {
         mContext = context;
         mUserManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
+        mActivityManager = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
     }
 
     /**
@@ -72,30 +74,64 @@
     }
 
     /**
-     * Gets {@link UserInfo} for the current user.
+     * Gets UserInfo for the foreground user.
      *
-     * @return {@link UserInfo} for the current user.
+     * Concept of foreground user is relevant for the multi-user deployment. Foreground user
+     * corresponds to the currently "logged in" user.
+     *
+     * @return {@link UserInfo} for the foreground user.
      */
-    public UserInfo getCurrentUserInfo() {
-        return mUserManager.getUserInfo(UserHandle.myUserId());
+    public UserInfo getForegroundUserInfo() {
+        return mUserManager.getUserInfo(getForegroundUserId());
     }
 
     /**
-     * Gets all the other users on the system that are not the current user.
-     *
-     * @return List of {@code UserInfo} for each user that is not the current user.
+     * @return Id of the foreground user.
      */
-    public List<UserInfo> getAllUsersExcludesCurrentUser() {
-        List<UserInfo> others = getAllUsers();
+    public int getForegroundUserId() {
+        return mActivityManager.getCurrentUser();
+    }
 
-        for (Iterator<UserInfo> iterator = others.iterator(); iterator.hasNext(); ) {
-            UserInfo userInfo = iterator.next();
-            if (userInfo.id == UserHandle.myUserId()) {
-                // Remove current user from the list.
-                iterator.remove();
-            }
-        }
-        return others;
+    /**
+     * Gets UserInfo for the user running the caller process.
+     *
+     * Differentiation between foreground user and current process user is relevant for multi-user
+     * deployments.
+     *
+     * Some multi-user aware components (like SystemUI) might run as a singleton - one component
+     * for all users. Current process user is then always the same for that component, even when
+     * the foreground user changes.
+     *
+     * @return {@link UserInfo} for the user running the current process.
+     */
+    public UserInfo getCurrentProcessUserInfo() {
+        return mUserManager.getUserInfo(getCurrentProcessUserId());
+    }
+
+    /**
+     * @return Id for the user running the current process.
+     */
+    public int getCurrentProcessUserId() {
+        return UserHandle.myUserId();
+    }
+
+    /**
+     * Gets all the other users on the system that are not the user running the current process.
+     *
+     * @return List of {@code UserInfo} for each user that is not the user running the process.
+     */
+    public List<UserInfo> getAllUsersExcludesCurrentProcessUser() {
+        return getAllUsersExceptUser(getCurrentProcessUserId());
+    }
+
+    /**
+     * Gets all the existing users on the system that are not the currently running as the
+     * foreground user.
+     *
+     * @return List of {@code UserInfo} for each user that is not the foreground user.
+     */
+    public List<UserInfo> getAllUsersExcludesForegroundUser() {
+        return getAllUsersExceptUser(getForegroundUserId());
     }
 
     /**
@@ -104,12 +140,22 @@
      * @return List of {@code UserInfo} for each user that is not the system user.
      */
     public List<UserInfo> getAllUsersExcludesSystemUser() {
+        return getAllUsersExceptUser(UserHandle.USER_SYSTEM);
+    }
+
+    /**
+     * Get all the users except the one with userId passed in.
+     *
+     * @param userId of the user not to be returned.
+     * @return All users other than user with userId.
+     */
+    public List<UserInfo> getAllUsersExceptUser(int userId) {
         List<UserInfo> others = getAllUsers();
 
         for (Iterator<UserInfo> iterator = others.iterator(); iterator.hasNext(); ) {
             UserInfo userInfo = iterator.next();
-            if (userIsSystemUser(userInfo)) {
-                // Remove system user from the list.
+            if (userInfo.id == userId) {
+                // Remove user with userId from the list.
                 iterator.remove();
             }
         }
@@ -146,78 +192,115 @@
     }
 
     /**
-     * Checks whether passed in user is the user that's currently logged in.
+     * Checks whether passed in user is the foreground user.
      *
      * @param userInfo User to check.
-     * @return {@code true} if current user, {@code false} otherwise.
+     * @return {@code true} if foreground user, {@code false} otherwise.
      */
-    public boolean userIsCurrentUser(UserInfo userInfo) {
-        return getCurrentUserInfo().id == userInfo.id;
+    public boolean userIsForegroundUser(UserInfo userInfo) {
+        return getForegroundUserId() == userInfo.id;
     }
 
-    // Current user information accessors
+    /**
+     * Checks whether passed in user is the user that's running the current process.
+     *
+     * @param userInfo User to check.
+     * @return {@code true} if user running the process, {@code false} otherwise.
+     */
+    public boolean userIsRunningCurrentProcess(UserInfo userInfo) {
+        return getCurrentProcessUserId() == userInfo.id;
+    }
+
+    // Foreground user information accessors.
 
     /**
-     * Checks if the current user is a demo user.
+     * Checks if the foreground user is a guest user.
      */
-    public boolean isDemoUser() {
+    public boolean foregroundUserIsGuestUser() {
+      return getForegroundUserInfo().isGuest();
+    }
+
+    /**
+     * Return whether the foreground user has a restriction.
+     *
+     * @param restriction Restriction to check. Should be a UserManager.* restriction.
+     * @return Whether that restriction exists for the foreground user.
+     */
+    public boolean foregroundUserHasUserRestriction(String restriction) {
+        return mUserManager.hasUserRestriction(restriction, getForegroundUserInfo().getUserHandle());
+    }
+
+    /**
+     * Checks if the foreground user can add new users.
+     */
+    public boolean foregroundUserCanAddUsers() {
+        return !foregroundUserHasUserRestriction(UserManager.DISALLOW_ADD_USER);
+    }
+
+    // Current process user information accessors
+
+    /**
+     * Checks if the calling app is running in a demo user.
+     */
+    public boolean currentProcessRunningAsDemoUser() {
         return mUserManager.isDemoUser();
     }
 
     /**
-     * Checks if the current user is a guest user.
+     * Checks if the calling app is running as a guest user.
      */
-    public boolean isGuestUser() {
+    public boolean currentProcessRunningAsGuestUser() {
         return mUserManager.isGuestUser();
     }
 
     /**
-     * Checks if the current user is the system user (User 0).
+     * Checks whether this process is running under the system user.
      */
-    public boolean isSystemUser() {
+    public boolean currentProcessRunningAsSystemUser() {
         return mUserManager.isSystemUser();
     }
 
-    // Current user restriction accessors
+    // Current process user restriction accessors
 
     /**
-     * Return whether the current user has a restriction.
+     * Return whether the user running the current process has a restriction.
      *
      * @param restriction Restriction to check. Should be a UserManager.* restriction.
-     * @return Whether that restriction exists for the current user.
+     * @return Whether that restriction exists for the user running the process.
      */
-    public boolean hasUserRestriction(String restriction) {
+    public boolean currentProcessHasUserRestriction(String restriction) {
         return mUserManager.hasUserRestriction(restriction);
     }
 
     /**
-     * Checks if the current user can add new users.
+     * Checks if the user running the current process can add new users.
      */
-    public boolean canAddUsers() {
-        return !hasUserRestriction(UserManager.DISALLOW_ADD_USER);
+    public boolean currentProcessCanAddUsers() {
+        return !currentProcessHasUserRestriction(UserManager.DISALLOW_ADD_USER);
     }
 
     /**
-     * Checks if the current user can remove users.
+     * Checks if the user running the current process can remove users.
      */
-    public boolean canRemoveUsers() {
-        return !hasUserRestriction(UserManager.DISALLOW_REMOVE_USER);
+    public boolean currentProcessCanRemoveUsers() {
+        return !currentProcessHasUserRestriction(UserManager.DISALLOW_REMOVE_USER);
     }
 
     /**
-     * Checks if the current user is allowed to switch to another user.
+     * Checks if the user running the current process is allowed to switch to another user.
      */
-    public boolean canSwitchUsers() {
-        return !hasUserRestriction(UserManager.DISALLOW_USER_SWITCH);
+    public boolean currentProcessCanSwitchUsers() {
+        return !currentProcessHasUserRestriction(UserManager.DISALLOW_USER_SWITCH);
     }
 
     /**
-     * Checks if the current user can modify accounts. Demo and Guest users cannot modify accounts
-     * even if the DISALLOW_MODIFY_ACCOUNTS restriction is not applied.
+     * Checks if the current process user can modify accounts. Demo and Guest users cannot modify
+     * accounts even if the DISALLOW_MODIFY_ACCOUNTS restriction is not applied.
      */
-    public boolean canModifyAccounts() {
-        return !hasUserRestriction(UserManager.DISALLOW_MODIFY_ACCOUNTS) && !isDemoUser()
-                && !isGuestUser();
+    public boolean currentProcessCanModifyAccounts() {
+        return !currentProcessHasUserRestriction(UserManager.DISALLOW_MODIFY_ACCOUNTS)
+                && !currentProcessRunningAsDemoUser()
+                && !currentProcessRunningAsGuestUser();
     }
 
     // User actions
@@ -242,8 +325,8 @@
 
     /**
      * Tries to remove the user that's passed in. System user cannot be removed.
-     * If the user to be removed is current user, it switches to the system user first, and then
-     * removes the user.
+     * If the user to be removed is user currently running the process,
+     * it switches to the system user first, and then removes the user.
      *
      * @param userInfo User to be removed
      * @return {@code true} if user is successfully removed, {@code false} otherwise.
@@ -254,7 +337,7 @@
             return false;
         }
 
-        if (userInfo.id == getCurrentUserInfo().id) {
+        if (userInfo.id == getCurrentProcessUserId()) {
             switchToUserId(UserHandle.USER_SYSTEM);
         }
 
@@ -267,7 +350,7 @@
      * @param userInfo User to switch to.
      */
     public void switchToUser(UserInfo userInfo) {
-        if (userInfo.id == getCurrentUserInfo().id) {
+        if (userInfo.id == getForegroundUserId()) {
             return;
         }
 
@@ -276,15 +359,6 @@
             return;
         }
 
-        if (UserManager.isGuestUserEphemeral()) {
-            // If switching from guest, we want to bring up the guest exit dialog instead of
-            // switching
-            UserInfo currUserInfo = getCurrentUserInfo();
-            if (currUserInfo != null && currUserInfo.isGuest()) {
-                return;
-            }
-        }
-
         switchToUserId(userInfo.id);
     }
 
@@ -348,6 +422,9 @@
         filter.addAction(Intent.ACTION_USER_REMOVED);
         filter.addAction(Intent.ACTION_USER_ADDED);
         filter.addAction(Intent.ACTION_USER_INFO_CHANGED);
+        filter.addAction(Intent.ACTION_USER_SWITCHED);
+        filter.addAction(Intent.ACTION_USER_STOPPED);
+        filter.addAction(Intent.ACTION_USER_UNLOCKED);
         mContext.registerReceiverAsUser(mUserChangeReceiver, UserHandle.ALL, filter, null, null);
     }
 
@@ -366,9 +443,7 @@
 
     private void switchToUserId(int id) {
         try {
-            final ActivityManager am = (ActivityManager)
-                    mContext.getSystemService(Context.ACTIVITY_SERVICE);
-            am.switchUser(id);
+            mActivityManager.switchUser(id);
         } catch (Exception e) {
             Log.e(TAG, "Couldn't switch user.", e);
         }
@@ -389,4 +464,3 @@
         void onUsersUpdate();
     }
 }
-
diff --git a/packages/SettingsLib/tests/integ/src/com/android/settingslib/users/UserManagerHelperTest.java b/packages/SettingsLib/tests/integ/src/com/android/settingslib/users/UserManagerHelperTest.java
index 3f1fcbb..15f7770 100644
--- a/packages/SettingsLib/tests/integ/src/com/android/settingslib/users/UserManagerHelperTest.java
+++ b/packages/SettingsLib/tests/integ/src/com/android/settingslib/users/UserManagerHelperTest.java
@@ -58,7 +58,7 @@
     private UserManagerHelper.OnUsersUpdateListener mTestListener;
 
     private UserManagerHelper mHelper;
-    private UserInfo mCurrentUser;
+    private UserInfo mCurrentProcessUser;
     private UserInfo mSystemUser;
 
     @Before
@@ -70,13 +70,13 @@
                 .thenReturn(InstrumentationRegistry.getTargetContext().getResources());
         mHelper = new UserManagerHelper(mContext);
 
-        mCurrentUser = createUserInfoForId(UserHandle.myUserId());
+        mCurrentProcessUser = createUserInfoForId(UserHandle.myUserId());
         mSystemUser = createUserInfoForId(UserHandle.USER_SYSTEM);
-        when(mUserManager.getUserInfo(UserHandle.myUserId())).thenReturn(mCurrentUser);
+        when(mUserManager.getUserInfo(UserHandle.myUserId())).thenReturn(mCurrentProcessUser);
     }
 
     @Test
-    public void testUserIsSystemUser() {
+    public void userIsSystemUser() {
         UserInfo testInfo = new UserInfo();
 
         testInfo.id = UserHandle.USER_SYSTEM;
@@ -87,33 +87,7 @@
     }
 
     @Test
-    public void testGetAllUsersExcludesCurrentUser() {
-        int currentUser = UserHandle.myUserId();
-
-        UserInfo otherUser1 = createUserInfoForId(currentUser + 1);
-        UserInfo otherUser2 = createUserInfoForId(currentUser - 1);
-        UserInfo otherUser3 = createUserInfoForId(currentUser + 2);
-
-        List<UserInfo> testUsers = new ArrayList<>();
-        testUsers.add(otherUser1);
-        testUsers.add(otherUser2);
-        testUsers.add(mCurrentUser);
-        testUsers.add(otherUser3);
-
-        when(mUserManager.getUsers(true)).thenReturn(testUsers);
-
-        // Should return 3 users that don't have currentUser id.
-        assertThat(mHelper.getAllUsersExcludesCurrentUser().size()).isEqualTo(3);
-        // Should not contain current user.
-        assertThat(mHelper.getAllUsersExcludesCurrentUser()).doesNotContain(mCurrentUser);
-        // Should contain non-current users.
-        assertThat(mHelper.getAllUsersExcludesCurrentUser()).contains(otherUser1);
-        assertThat(mHelper.getAllUsersExcludesCurrentUser()).contains(otherUser2);
-        assertThat(mHelper.getAllUsersExcludesCurrentUser()).contains(otherUser3);
-    }
-
-    @Test
-    public void testGetAllUsersExcludesSystemUser() {
+    public void getAllUsersExcludesSystemUser() {
         UserInfo otherUser1 = createUserInfoForId(10);
         UserInfo otherUser2 = createUserInfoForId(11);
         UserInfo otherUser3 = createUserInfoForId(12);
@@ -127,17 +101,41 @@
         when(mUserManager.getUsers(true)).thenReturn(testUsers);
 
         // Should return 3 users that don't have SYSTEM USER id.
-        assertThat(mHelper.getAllUsersExcludesSystemUser().size()).isEqualTo(3);
-        // Should not contain system user.
-        assertThat(mHelper.getAllUsersExcludesSystemUser()).doesNotContain(mSystemUser);
-        // Should contain non-system users.
-        assertThat(mHelper.getAllUsersExcludesSystemUser()).contains(otherUser1);
-        assertThat(mHelper.getAllUsersExcludesSystemUser()).contains(otherUser2);
-        assertThat(mHelper.getAllUsersExcludesSystemUser()).contains(otherUser3);
+        assertThat(mHelper.getAllUsersExcludesSystemUser()).hasSize(3);
+        assertThat(mHelper.getAllUsersExcludesSystemUser())
+                .containsExactly(otherUser1, otherUser2, otherUser3);
     }
 
     @Test
-    public void testGetAllUsers() {
+    public void getAllUsersExceptUser() {
+        UserInfo user1 = createUserInfoForId(10);
+        UserInfo user2 = createUserInfoForId(10);
+        UserInfo user3 = createUserInfoForId(12);
+
+        List<UserInfo> testUsers = new ArrayList<>();
+        testUsers.add(user1);
+        testUsers.add(user2);
+        testUsers.add(user3);
+
+        when(mUserManager.getUsers(true)).thenReturn(new ArrayList<>(testUsers));
+
+        // Should return all 3 users.
+        assertThat(mHelper.getAllUsersExceptUser(9).size()).isEqualTo(3);
+
+        // Should return only user 12.
+        assertThat(mHelper.getAllUsersExceptUser(10).size()).isEqualTo(1);
+        assertThat(mHelper.getAllUsersExceptUser(10)).contains(user3);
+
+        when(mUserManager.getUsers(true)).thenReturn(new ArrayList<>(testUsers));
+
+        // Should drop user 12.
+        assertThat(mHelper.getAllUsersExceptUser(12).size()).isEqualTo(2);
+        assertThat(mHelper.getAllUsersExceptUser(12)).contains(user1);
+        assertThat(mHelper.getAllUsersExceptUser(12)).contains(user2);
+    }
+
+    @Test
+    public void getAllUsers() {
         int currentUser = UserHandle.myUserId();
 
         UserInfo otherUser1 = createUserInfoForId(currentUser + 1);
@@ -147,21 +145,18 @@
         List<UserInfo> testUsers = new ArrayList<>();
         testUsers.add(otherUser1);
         testUsers.add(otherUser2);
-        testUsers.add(mCurrentUser);
+        testUsers.add(mCurrentProcessUser);
         testUsers.add(otherUser3);
 
         when(mUserManager.getUsers(true)).thenReturn(testUsers);
 
-        // Should return 3 users that don't have currentUser id.
         assertThat(mHelper.getAllUsers().size()).isEqualTo(4);
-        assertThat(mHelper.getAllUsers()).contains(mCurrentUser);
-        assertThat(mHelper.getAllUsers()).contains(otherUser1);
-        assertThat(mHelper.getAllUsers()).contains(otherUser2);
-        assertThat(mHelper.getAllUsers()).contains(otherUser3);
+        assertThat(mHelper.getAllUsers())
+                .containsExactly(mCurrentProcessUser, otherUser1, otherUser2, otherUser3);
     }
 
     @Test
-    public void testUserCanBeRemoved() {
+    public void userCanBeRemoved() {
         UserInfo testInfo = new UserInfo();
 
         // System user cannot be removed.
@@ -173,71 +168,59 @@
     }
 
     @Test
-    public void testUserIsCurrentUser() {
-        UserInfo testInfo = new UserInfo();
-
-        // System user cannot be removed.
-        testInfo.id = UserHandle.myUserId();
-        assertThat(mHelper.userIsCurrentUser(testInfo)).isTrue();
-
-        testInfo.id = UserHandle.myUserId() + 2;
-        assertThat(mHelper.userIsCurrentUser(testInfo)).isFalse();
-    }
-
-    @Test
-    public void testCanAddUsers() {
+    public void currentProcessCanAddUsers() {
         when(mUserManager.hasUserRestriction(UserManager.DISALLOW_ADD_USER)).thenReturn(false);
-        assertThat(mHelper.canAddUsers()).isTrue();
+        assertThat(mHelper.currentProcessCanAddUsers()).isTrue();
 
         when(mUserManager.hasUserRestriction(UserManager.DISALLOW_ADD_USER)).thenReturn(true);
-        assertThat(mHelper.canAddUsers()).isFalse();
+        assertThat(mHelper.currentProcessCanAddUsers()).isFalse();
     }
 
     @Test
-    public void testCanRemoveUsers() {
+    public void currentProcessCanRemoveUsers() {
         when(mUserManager.hasUserRestriction(UserManager.DISALLOW_REMOVE_USER)).thenReturn(false);
-        assertThat(mHelper.canRemoveUsers()).isTrue();
+        assertThat(mHelper.currentProcessCanRemoveUsers()).isTrue();
 
         when(mUserManager.hasUserRestriction(UserManager.DISALLOW_REMOVE_USER)).thenReturn(true);
-        assertThat(mHelper.canRemoveUsers()).isFalse();
+        assertThat(mHelper.currentProcessCanRemoveUsers()).isFalse();
     }
 
     @Test
-    public void testCanSwitchUsers() {
+    public void currentProcessCanSwitchUsers() {
         when(mUserManager.hasUserRestriction(UserManager.DISALLOW_USER_SWITCH)).thenReturn(false);
-        assertThat(mHelper.canSwitchUsers()).isTrue();
+        assertThat(mHelper.currentProcessCanSwitchUsers()).isTrue();
 
         when(mUserManager.hasUserRestriction(UserManager.DISALLOW_USER_SWITCH)).thenReturn(true);
-        assertThat(mHelper.canSwitchUsers()).isFalse();
+        assertThat(mHelper.currentProcessCanSwitchUsers()).isFalse();
     }
 
     @Test
-    public void testGuestCannotModifyAccounts() {
-        assertThat(mHelper.canModifyAccounts()).isTrue();
+    public void currentProcessRunningAsGuestCannotModifyAccounts() {
+        assertThat(mHelper.currentProcessCanModifyAccounts()).isTrue();
 
         when(mUserManager.isGuestUser()).thenReturn(true);
-        assertThat(mHelper.canModifyAccounts()).isFalse();
+        assertThat(mHelper.currentProcessCanModifyAccounts()).isFalse();
     }
 
     @Test
-    public void testDemoUserCannotModifyAccounts() {
-        assertThat(mHelper.canModifyAccounts()).isTrue();
+    public void currentProcessRunningAsDemoUserCannotModifyAccounts() {
+        assertThat(mHelper.currentProcessCanModifyAccounts()).isTrue();
 
         when(mUserManager.isDemoUser()).thenReturn(true);
-        assertThat(mHelper.canModifyAccounts()).isFalse();
+        assertThat(mHelper.currentProcessCanModifyAccounts()).isFalse();
     }
 
     @Test
-    public void testUserWithDisallowModifyAccountsRestrictionCannotModifyAccounts() {
-        assertThat(mHelper.canModifyAccounts()).isTrue();
+    public void currentProcessWithDisallowModifyAccountsRestrictionCannotModifyAccounts() {
+        assertThat(mHelper.currentProcessCanModifyAccounts()).isTrue();
 
         when(mUserManager.hasUserRestriction(UserManager.DISALLOW_MODIFY_ACCOUNTS))
                 .thenReturn(true);
-        assertThat(mHelper.canModifyAccounts()).isFalse();
+        assertThat(mHelper.currentProcessCanModifyAccounts()).isFalse();
     }
 
     @Test
-    public void testCreateNewUser() {
+    public void createNewUser() {
         // Verify createUser on UserManager gets called.
         mHelper.createNewUser("Test User");
         verify(mUserManager).createUser("Test User", 0);
@@ -252,52 +235,36 @@
     }
 
     @Test
-    public void testRemoveUser() {
+    public void removeUser() {
         // Cannot remove system user.
         assertThat(mHelper.removeUser(mSystemUser)).isFalse();
 
         // Removing non-current, non-system user, simply calls removeUser.
-        UserInfo userToRemove = createUserInfoForId(mCurrentUser.id + 2);
+        UserInfo userToRemove = createUserInfoForId(mCurrentProcessUser.id + 2);
+
         mHelper.removeUser(userToRemove);
-        verify(mUserManager).removeUser(mCurrentUser.id + 2);
+        verify(mUserManager).removeUser(mCurrentProcessUser.id + 2);
     }
 
     @Test
-    public void testSwitchToUser() {
-        // Switching to current user doesn't do anything.
-        mHelper.switchToUser(mCurrentUser);
-        verify(mActivityManager, never()).switchUser(mCurrentUser.id);
-
-        // Switching to Guest calls createGuest.
-        UserInfo guestInfo = new UserInfo(mCurrentUser.id + 1, "Test Guest", UserInfo.FLAG_GUEST);
-        mHelper.switchToUser(guestInfo);
-        verify(mUserManager).createGuest(mContext, "Test Guest");
-
-        // Switching to non-current, non-guest user, simply calls switchUser.
-        UserInfo userToSwitchTo = new UserInfo(mCurrentUser.id + 5, "Test User", 0);
-        mHelper.switchToUser(userToSwitchTo);
-        verify(mActivityManager).switchUser(mCurrentUser.id + 5);
-    }
-
-    @Test
-    public void testSwitchToGuest() {
+    public void switchToGuest() {
         mHelper.switchToGuest("Test Guest");
         verify(mUserManager).createGuest(mContext, "Test Guest");
 
-        UserInfo guestInfo = new UserInfo(mCurrentUser.id + 2, "Test Guest", UserInfo.FLAG_GUEST);
+        UserInfo guestInfo = new UserInfo(21, "Test Guest", UserInfo.FLAG_GUEST);
         when(mUserManager.createGuest(mContext, "Test Guest")).thenReturn(guestInfo);
         mHelper.switchToGuest("Test Guest");
-        verify(mActivityManager).switchUser(mCurrentUser.id + 2);
+        verify(mActivityManager).switchUser(21);
     }
 
     @Test
-    public void testGetUserIcon() {
-        mHelper.getUserIcon(mCurrentUser);
-        verify(mUserManager).getUserIcon(mCurrentUser.id);
+    public void getUserIcon() {
+        mHelper.getUserIcon(mCurrentProcessUser);
+        verify(mUserManager).getUserIcon(mCurrentProcessUser.id);
     }
 
     @Test
-    public void testScaleUserIcon() {
+    public void scaleUserIcon() {
         Bitmap fakeIcon = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888);
         Drawable scaledIcon = mHelper.scaleUserIcon(fakeIcon, 300);
         assertThat(scaledIcon.getIntrinsicWidth()).isEqualTo(300);
@@ -305,14 +272,14 @@
     }
 
     @Test
-    public void testSetUserName() {
-        UserInfo testInfo = createUserInfoForId(mCurrentUser.id + 3);
+    public void setUserName() {
+        UserInfo testInfo = createUserInfoForId(mCurrentProcessUser.id + 3);
         mHelper.setUserName(testInfo, "New Test Name");
-        verify(mUserManager).setUserName(mCurrentUser.id + 3, "New Test Name");
+        verify(mUserManager).setUserName(mCurrentProcessUser.id + 3, "New Test Name");
     }
 
     @Test
-    public void testRegisterUserChangeReceiver() {
+    public void registerUserChangeReceiver() {
         mHelper.registerOnUsersUpdateListener(mTestListener);
 
         ArgumentCaptor<BroadcastReceiver> receiverCaptor =
@@ -335,10 +302,14 @@
         // Verify the presence of each intent in the filter.
         // Verify the exact number of filters. Every time a new intent is added, this test should
         // get updated.
-        assertThat(filterCaptor.getValue().countActions()).isEqualTo(3);
+        assertThat(filterCaptor.getValue().countActions()).isEqualTo(6);
         assertThat(filterCaptor.getValue().hasAction(Intent.ACTION_USER_REMOVED)).isTrue();
         assertThat(filterCaptor.getValue().hasAction(Intent.ACTION_USER_ADDED)).isTrue();
         assertThat(filterCaptor.getValue().hasAction(Intent.ACTION_USER_INFO_CHANGED)).isTrue();
+        assertThat(filterCaptor.getValue().hasAction(Intent.ACTION_USER_SWITCHED)).isTrue();
+        assertThat(filterCaptor.getValue().hasAction(Intent.ACTION_USER_STOPPED)).isTrue();
+        assertThat(filterCaptor.getValue().hasAction(Intent.ACTION_USER_UNLOCKED)).isTrue();
+
 
         // Verify that calling the receiver calls the listener.
         receiverCaptor.getValue().onReceive(mContext, new Intent());
diff --git a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/testutils/shadow/ShadowActivityManager.java b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/testutils/shadow/ShadowActivityManager.java
new file mode 100644
index 0000000..4a8ef1e
--- /dev/null
+++ b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/testutils/shadow/ShadowActivityManager.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settingslib.testutils.shadow;
+
+import android.app.ActivityManager;
+
+import org.robolectric.RuntimeEnvironment;
+import org.robolectric.annotation.Implementation;
+import org.robolectric.annotation.Implements;
+import org.robolectric.annotation.Resetter;
+import org.robolectric.shadow.api.Shadow;
+
+@Implements(ActivityManager.class)
+public class ShadowActivityManager {
+    private static int sCurrentUserId = 0;
+    private int mUserSwitchedTo = -1;
+
+    @Resetter
+    public void reset() {
+        sCurrentUserId = 0;
+        mUserSwitchedTo = 0;
+    }
+
+    @Implementation
+    public static int getCurrentUser() {
+        return sCurrentUserId;
+    }
+
+    @Implementation
+    public boolean switchUser(int userId) {
+        mUserSwitchedTo = userId;
+        return true;
+    }
+
+    public boolean getSwitchUserCalled() {
+        return mUserSwitchedTo != -1;
+    }
+
+    public int getUserSwitchedTo() {
+        return mUserSwitchedTo;
+    }
+
+    public static void setCurrentUser(int userId) {
+        sCurrentUserId = userId;
+    }
+
+    public static ShadowActivityManager getShadow() {
+        return (ShadowActivityManager) Shadow.extract(
+                RuntimeEnvironment.application.getSystemService(ActivityManager.class));
+    }
+}
diff --git a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/users/UserManagerHelperRoboTest.java b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/users/UserManagerHelperRoboTest.java
new file mode 100644
index 0000000..f2ea3a4
--- /dev/null
+++ b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/users/UserManagerHelperRoboTest.java
@@ -0,0 +1,224 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settingslib.users;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.app.ActivityManager;
+
+import android.content.Context;
+import android.content.pm.UserInfo;
+import android.os.UserHandle;
+import android.os.UserManager;
+
+import com.android.settingslib.testutils.shadow.ShadowActivityManager;
+import com.android.settingslib.SettingsLibRobolectricTestRunner;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RuntimeEnvironment;
+import org.robolectric.annotation.Config;
+import org.robolectric.annotation.Implementation;
+import org.robolectric.annotation.Implements;
+import org.robolectric.annotation.Resetter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@RunWith(SettingsLibRobolectricTestRunner.class)
+@Config(shadows = { ShadowActivityManager.class, UserManagerHelperRoboTest.ShadowUserHandle.class})
+public class UserManagerHelperRoboTest {
+    @Mock
+    private Context mContext;
+    @Mock
+    private UserManager mUserManager;
+
+    private UserManagerHelper mHelper;
+
+    @Before
+    public void setUpMocksAndUserManagerHelper() {
+        MockitoAnnotations.initMocks(this);
+        when(mContext.getSystemService(Context.USER_SERVICE)).thenReturn(mUserManager);
+        when(mContext.getSystemService(Context.ACTIVITY_SERVICE)).thenReturn(
+                RuntimeEnvironment.application.getSystemService(ActivityManager.class));
+        mHelper = new UserManagerHelper(mContext);
+    }
+
+    @After
+    public void tearDown() {
+        ShadowActivityManager.getShadow().reset();
+    }
+
+    @Test
+    public void getForegroundUserId() {
+        ShadowActivityManager.setCurrentUser(15);
+        assertThat(mHelper.getForegroundUserId()).isEqualTo(15);
+    }
+
+    @Test
+    public void getForegroundUserInfo() {
+        ShadowActivityManager.setCurrentUser(17);
+        when(mUserManager.getUserInfo(ShadowActivityManager.getCurrentUser()))
+                .thenReturn(createUserInfoForId(ShadowActivityManager.getCurrentUser()));
+        assertThat(mHelper.getForegroundUserInfo().id).isEqualTo(17);
+    }
+
+    @Test
+    public void getCurrentProcessUserId() {
+        ShadowUserHandle.setUid(11);
+        assertThat(mHelper.getCurrentProcessUserId()).isEqualTo(11);
+    }
+
+    @Test
+    public void getCurrentProcessUserInfo() {
+        ShadowUserHandle.setUid(12);
+        when(mUserManager.getUserInfo(UserHandle.myUserId()))
+                .thenReturn(createUserInfoForId(UserHandle.myUserId()));
+        assertThat(mHelper.getCurrentProcessUserInfo().id).isEqualTo(12);
+    }
+
+    @Test
+    public void getAllUsersExcludesCurrentProcessUser() {
+        ShadowUserHandle.setUid(12);
+        UserInfo currentProcessUser = createUserInfoForId(12);
+
+        UserInfo otherUser1 = createUserInfoForId(13);
+        UserInfo otherUser2 = createUserInfoForId(11);
+        UserInfo otherUser3 = createUserInfoForId(14);
+
+        List<UserInfo> testUsers = new ArrayList<>();
+        testUsers.add(otherUser1);
+        testUsers.add(otherUser2);
+        testUsers.add(currentProcessUser);
+        testUsers.add(otherUser3);
+
+        when(mUserManager.getUsers(true)).thenReturn(testUsers);
+
+        // Should return 3 users that don't have currentProcessUser id.
+        assertThat(mHelper.getAllUsersExcludesCurrentProcessUser()).hasSize(3);
+        assertThat(mHelper.getAllUsersExcludesCurrentProcessUser())
+                .containsExactly(otherUser1, otherUser2, otherUser3);
+    }
+
+    @Test
+    public void getAllUsersExcludesForegroundUser() {
+        ShadowActivityManager.setCurrentUser(17);
+        UserInfo foregroundUser = createUserInfoForId(17);
+
+        UserInfo otherUser1 = createUserInfoForId(11);
+        UserInfo otherUser2 = createUserInfoForId(18);
+        UserInfo otherUser3 = createUserInfoForId(16);
+
+        List<UserInfo> testUsers = new ArrayList<>();
+        testUsers.add(otherUser1);
+        testUsers.add(otherUser2);
+        testUsers.add(foregroundUser);
+        testUsers.add(otherUser3);
+
+        when(mUserManager.getUsers(true)).thenReturn(testUsers);
+
+        // Should return 3 users that don't have foregroundUser id.
+        assertThat(mHelper.getAllUsersExcludesForegroundUser()).hasSize(3);
+        assertThat(mHelper.getAllUsersExcludesForegroundUser())
+                .containsExactly(otherUser1, otherUser2, otherUser3);
+    }
+
+    @Test
+    public void userIsForegroundUser() {
+        ShadowActivityManager.setCurrentUser(10);
+        assertThat(mHelper.userIsForegroundUser(createUserInfoForId(10))).isTrue();
+        assertThat(mHelper.userIsForegroundUser(createUserInfoForId(11))).isFalse();
+
+        ShadowActivityManager.setCurrentUser(11);
+        assertThat(mHelper.userIsForegroundUser(createUserInfoForId(11))).isTrue();
+    }
+
+    @Test
+    public void userIsRunningCurrentProcess() {
+        ShadowUserHandle.setUid(10);
+        assertThat(mHelper.userIsRunningCurrentProcess(createUserInfoForId(10))).isTrue();
+        assertThat(mHelper.userIsRunningCurrentProcess(createUserInfoForId(11))).isFalse();
+
+        ShadowUserHandle.setUid(11);
+        assertThat(mHelper.userIsRunningCurrentProcess(createUserInfoForId(11))).isTrue();
+    }
+
+    @Test
+    public void removingCurrentProcessUserSwitchesToSystemUser() {
+        // Set currentProcess user to be user 10.
+        ShadowUserHandle.setUid(10);
+
+        // Removing a currentProcess user, calls "switch" to system user
+        mHelper.removeUser(createUserInfoForId(10));
+        assertThat(ShadowActivityManager.getShadow().getSwitchUserCalled()).isTrue();
+        assertThat(ShadowActivityManager.getShadow().getUserSwitchedTo()).isEqualTo(0);
+
+        verify(mUserManager).removeUser(10);
+    }
+
+    @Test
+    public void switchToUser() {
+        ShadowActivityManager.setCurrentUser(20);
+
+        // Switching to foreground user doesn't do anything.
+        mHelper.switchToUser(createUserInfoForId(20));
+        assertThat(ShadowActivityManager.getShadow().getSwitchUserCalled()).isFalse();
+
+        // Switching to Guest calls createGuest.
+        UserInfo guestInfo = new UserInfo(21, "Test Guest", UserInfo.FLAG_GUEST);
+        mHelper.switchToUser(guestInfo);
+        verify(mUserManager).createGuest(mContext, "Test Guest");
+
+        // Switching to non-current, non-guest user, simply calls switchUser.
+        UserInfo userToSwitchTo = new UserInfo(22, "Test User", 0);
+        mHelper.switchToUser(userToSwitchTo);
+        assertThat(ShadowActivityManager.getShadow().getSwitchUserCalled()).isTrue();
+        assertThat(ShadowActivityManager.getShadow().getUserSwitchedTo()).isEqualTo(22);
+    }
+
+    private UserInfo createUserInfoForId(int id) {
+        UserInfo userInfo = new UserInfo();
+        userInfo.id = id;
+        return userInfo;
+    }
+
+    @Implements(UserHandle.class)
+    public static class ShadowUserHandle {
+        private static int sUid = 0; // SYSTEM by default
+
+        public static void setUid(int uid) {
+            sUid = uid;
+        }
+
+        @Implementation
+        public static int myUserId() {
+            return sUid;
+        }
+
+        @Resetter
+        public static void reset() {
+            sUid = 0;
+        }
+    }
+}
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
index a6d6250..022e306 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
@@ -2935,7 +2935,7 @@
         }
 
         private final class UpgradeController {
-            private static final int SETTINGS_VERSION = 162;
+            private static final int SETTINGS_VERSION = 163;
 
             private final int mUserId;
 
@@ -3709,6 +3709,21 @@
                     currentVersion = 162;
                 }
 
+                if (currentVersion == 162) {
+                    // Version 162: Add a gesture for silencing phones
+                    final SettingsState settings = getGlobalSettingsLocked();
+                    final Setting currentSetting = settings.getSettingLocked(
+                            Global.SHOW_ZEN_UPGRADE_NOTIFICATION);
+                    if (!currentSetting.isNull()
+                            && TextUtils.equals("0", currentSetting.getValue())) {
+                        settings.insertSettingLocked(
+                                Global.SHOW_ZEN_UPGRADE_NOTIFICATION, "1",
+                                null, true, SettingsState.SYSTEM_PACKAGE_NAME);
+                    }
+
+                    currentVersion = 163;
+                }
+
                 // vXXX: Add new settings above this point.
 
                 if (currentVersion != newVersion) {
diff --git a/packages/SimAppDialog/res/drawable/ic_signal_cellular_alt_rounded_24px.xml b/packages/SimAppDialog/res/drawable/ic_signal_cellular_alt_rounded.xml
similarity index 97%
rename from packages/SimAppDialog/res/drawable/ic_signal_cellular_alt_rounded_24px.xml
rename to packages/SimAppDialog/res/drawable/ic_signal_cellular_alt_rounded.xml
index 85896e8..5add2a8 100644
--- a/packages/SimAppDialog/res/drawable/ic_signal_cellular_alt_rounded_24px.xml
+++ b/packages/SimAppDialog/res/drawable/ic_signal_cellular_alt_rounded.xml
@@ -15,8 +15,8 @@
     limitations under the License.
 -->
 <vector xmlns:android="http://schemas.android.com/apk/res/android"
-        android:width="21dp"
-        android:height="22dp"
+        android:width="32dp"
+        android:height="32dp"
         android:viewportWidth="21"
         android:viewportHeight="22">
 
diff --git a/packages/SimAppDialog/res/drawable/placeholder.xml b/packages/SimAppDialog/res/drawable/placeholder.xml
deleted file mode 100644
index 53eee74..0000000
--- a/packages/SimAppDialog/res/drawable/placeholder.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-    Copyright (C) 2018 The Android Open Source Project
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-         http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
--->
-<!-- TODO(b/72511181): replace when illustration is finished -->
-
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-        android:width="270dp"
-        android:height="270dp"
-        android:viewportHeight="270.0"
-        android:viewportWidth="270.0">
-    <path android:fillColor="#E8EAED"
-          android:pathData="M183.54,265H84.88c-7.63,0 -13.81,-6.18 -13.81,-13.81V18.81C71.07,11.18 77.25,5 84.88,5h98.66c7.63,0 13.81,6.18 13.81,13.81v232.38C197.35,258.82 191.17,265 183.54,265z"/>
-    <path android:fillColor="#BDC1C6"
-          android:pathData="M183.54,6.63c6.72,0 12.18,5.46 12.18,12.18v232.38c0,6.72 -5.46,12.18 -12.18,12.18H84.88c-6.72,0 -12.18,-5.46 -12.18,-12.18V18.81c0,-6.72 5.46,-12.18 12.18,-12.18H183.54M183.54,5H84.88c-7.63,0 -13.81,6.18 -13.81,13.81v232.38c0,7.63 6.18,13.81 13.81,13.81h98.66c7.63,0 13.81,-6.18 13.81,-13.81V18.81C197.35,11.18 191.17,5 183.54,5L183.54,5z"/>
-    <path android:fillColor="#FFFFFF"
-          android:pathData="M186.34,243.74H82.08c-2.41,0 -4.36,-1.95 -4.36,-4.36V30.61c0,-2.41 1.95,-4.36 4.36,-4.36h104.26c2.41,0 4.36,1.95 4.36,4.36v208.78C190.7,241.79 188.75,243.74 186.34,243.74z"/>
-    <path android:fillColor="#BDC1C6"
-          android:pathData="M156.07,254.78h-43.72c-0.65,0 -1.18,-0.53 -1.18,-1.18v-0.08c0,-0.65 0.53,-1.18 1.18,-1.18h43.72c0.65,0 1.18,0.53 1.18,1.18v0.08C157.25,254.25 156.72,254.78 156.07,254.78z"/>
-    <path android:fillColor="#BDC1C6"
-          android:pathData="M156.07,17.67h-43.72c-0.65,0 -1.18,-0.53 -1.18,-1.18V16.4c0,-0.65 0.53,-1.18 1.18,-1.18l43.72,0c0.65,0 1.18,0.53 1.18,1.18v0.08C157.25,17.14 156.72,17.67 156.07,17.67z"/>
-    <path android:fillColor="#BDC1C6"
-          android:pathData="M197.85,84.16h-0.5V67.51h0.5c0.6,0 1.08,0.48 1.08,1.08v14.5C198.93,83.68 198.45,84.16 197.85,84.16z"/>
-    <path android:fillColor="#BDC1C6"
-          android:pathData="M197.41,136.45h-0.06v-32.87h0.06c0.84,0 1.52,0.68 1.52,1.52v29.84C198.93,135.77 198.25,136.45 197.41,136.45z"/>
-    <path android:fillColor="#BDC1C6"
-          android:pathData="M119.3,74.73l2.71,2.71c6.74,-6.74 17.67,-6.74 24.4,0l2.71,-2.71C140.89,66.49 127.54,66.49 119.3,74.73zM130.15,85.57l4.07,4.07l4.07,-4.07C136.04,83.33 132.39,83.33 130.15,85.57zM124.72,80.15l2.71,2.71c3.74,-3.74 9.82,-3.74 13.56,0l2.71,-2.71C138.46,74.91 129.96,74.91 124.72,80.15z"/>
-    <path android:fillColor="#BDC1C6"
-          android:pathData="M143.7,179h-1.36v-2.71h-2.71V179h-10.85v-2.71h-2.71V179h-1.36c-1.5,0 -2.7,1.21 -2.7,2.71l-0.01,18.98c0,1.5 1.21,2.71 2.71,2.71h18.98c1.5,0 2.71,-1.21 2.71,-2.71v-18.98C146.41,180.22 145.2,179 143.7,179zM143.7,200.7h-18.98v-14.91h18.98V200.7zM127.43,188.49h6.78v6.78h-6.78V188.49z"/>
-    <path android:fillColor="#BDC1C6"
-          android:pathData="M146.41,144.49v-18.98c0,-1.5 -1.21,-2.71 -2.71,-2.71h-18.98c-1.5,0 -2.71,1.21 -2.71,2.71v18.98c0,1.5 1.21,2.71 2.71,2.71h18.98C145.2,147.2 146.41,145.99 146.41,144.49zM129.47,137.03l3.39,4.07l4.75,-6.11l6.1,8.13h-18.98L129.47,137.03z"/>
-</vector>
diff --git a/packages/SimAppDialog/res/layout/install_carrier_app_activity.xml b/packages/SimAppDialog/res/layout/install_carrier_app_activity.xml
index 0462a93..5bcce4d 100644
--- a/packages/SimAppDialog/res/layout/install_carrier_app_activity.xml
+++ b/packages/SimAppDialog/res/layout/install_carrier_app_activity.xml
@@ -20,7 +20,7 @@
     android:id="@+id/setup_wizard_layout"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:icon="@drawable/ic_signal_cellular_alt_rounded_24px"
+    android:icon="@drawable/ic_signal_cellular_alt_rounded"
     app:suwHeaderText="@string/install_carrier_app_title"
     app:suwFooter="@layout/install_carrier_app_footer">
 
@@ -37,21 +37,6 @@
             android:text="@string/install_carrier_app_description_default"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"/>
-
-        <com.android.setupwizardlib.view.FillContentLayout
-            android:layout_width="match_parent"
-            android:layout_height="0dp"
-            android:layout_weight="1">
-
-            <!-- TODO(b/72511181): final illo and content description update -->
-            <ImageView
-                android:src="@drawable/placeholder"
-                style="@style/SuwContentIllustration"
-                android:contentDescription="@null"
-                android:layout_width="match_parent"
-                android:layout_height="match_parent"/>
-
-        </com.android.setupwizardlib.view.FillContentLayout>
     </LinearLayout>
 
 </com.android.setupwizardlib.GlifLayout>
diff --git a/packages/SimAppDialog/res/values/strings.xml b/packages/SimAppDialog/res/values/strings.xml
index 0c3930d..87941cb 100644
--- a/packages/SimAppDialog/res/values/strings.xml
+++ b/packages/SimAppDialog/res/values/strings.xml
@@ -15,22 +15,21 @@
     limitations under the License.
 -->
 <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-    <!-- TODO character limits -->
-    <!-- The name of this application -->
+    <!-- The name of this application [CHAR LIMIT=NONE] -->
     <string name="app_name">Sim App Dialog</string>
     <!-- Install Carrier App Activity -->
-    <!-- Title of screen asking user to download the carrier app to match the inserted SIM card -->
+    <!-- Title of screen asking user to download the carrier app to match the inserted SIM card [CHAR LIMIT=30] -->
     <string name="install_carrier_app_title">Activate mobile service</string>
-    <!-- Description of screen asking user to download the carrier app to match the inserted SIM card if we know the name of the carrier-->
+    <!-- Description of screen asking user to download the carrier app to match the inserted SIM card if we know the name of the carrier [CHAR LIMIT=90] -->
     <string name="install_carrier_app_description">To get your new SIM working properly, you\'ll
         need to install the <xliff:g name="carrier_name" example="Project Fi">%1$s</xliff:g> app
     </string>
-    <!-- Description of screen asking user to download the carrier app to match the inserted SIM card if we don't know the name of the carrier-->
+    <!-- Description of screen asking user to download the carrier app to match the inserted SIM card if we don't know the name of the carrier  [CHAR LIMIT=100] -->
     <string name="install_carrier_app_description_default">To get your new SIM working properly,
         you\'ll need to install the carrier app
     </string>
-    <!-- Name of the button used to defer downloading the carrier app -->
+    <!-- Name of the button used to defer downloading the carrier app  [CHAR LIMIT=25]-->
     <string name="install_carrier_app_defer_action">Not now</string>
-    <!-- Name of the button for downloading the carrier app -->
+    <!-- Name of the button for downloading the carrier app [CHAR LIMIT=25] -->
     <string name="install_carrier_app_download_action">Download app</string>
 </resources>
\ No newline at end of file
diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml
index d6fab4c..285b89f 100644
--- a/packages/SystemUI/AndroidManifest.xml
+++ b/packages/SystemUI/AndroidManifest.xml
@@ -206,7 +206,7 @@
     <uses-permission android:name="android.permission.WATCH_APPOPS" />
 
     <!-- to read and change hvac values in a car -->
-    <uses-permission android:name="android.car.permission.ADJUST_CAR_CLIMATE" />
+    <uses-permission android:name="android.car.permission.CONTROL_CAR_CLIMATE" />
 
     <application
         android:name=".SystemUIApplication"
diff --git a/packages/SystemUI/res/drawable/recents_onboarding_toast_rounded_background.xml b/packages/SystemUI/res/drawable/recents_onboarding_toast_rounded_background.xml
new file mode 100644
index 0000000..05db3a8
--- /dev/null
+++ b/packages/SystemUI/res/drawable/recents_onboarding_toast_rounded_background.xml
@@ -0,0 +1,19 @@
+<!--
+    Copyright (C) 2018 The Android Open Source Project
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
+    <solid android:color="?android:attr/colorAccent" />
+    <corners android:radius="8dp" />
+</shape>
\ No newline at end of file
diff --git a/packages/SystemUI/res/layout/recents_onboarding.xml b/packages/SystemUI/res/layout/recents_onboarding.xml
index 12f278a..6764eee 100644
--- a/packages/SystemUI/res/layout/recents_onboarding.xml
+++ b/packages/SystemUI/res/layout/recents_onboarding.xml
@@ -14,32 +14,48 @@
      limitations under the License.
 -->
 
-<FrameLayout
+<LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_height="48dp"
-    android:layout_width="match_parent"
-    android:background="@android:color/black"
-    android:layout_gravity="center">
-    <View
-        android:layout_width="match_parent"
-        android:layout_height="1dp"
-        android:background="?android:attr/listDivider"
-        android:gravity="top"/>
-    <TextView
-        android:id="@+id/onboarding_text"
+    android:layout_height="wrap_content"
+    android:layout_width="wrap_content"
+    android:paddingBottom="13dp"
+    android:orientation="vertical">
+
+    <LinearLayout
         android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_gravity="center"
-        android:textColor="@android:color/white"
-        android:textSize="16sp"
-        android:drawableBottom="@drawable/ic_chevron_up"/>
-    <ImageView
-        android:id="@+id/dismiss"
-        android:layout_width="48dp"
-        android:layout_height="48dp"
-        android:padding="12dp"
-        android:layout_marginEnd="6dp"
-        android:src="@drawable/ic_close_white"
-        android:background="?android:attr/selectableItemBackgroundBorderless"
-        android:layout_gravity="center_vertical|end"/>
-</FrameLayout>
\ No newline at end of file
+        android:layout_height="40dp"
+        android:paddingStart="24dp"
+        android:paddingEnd="4dp"
+        android:background="@drawable/recents_onboarding_toast_rounded_background"
+        android:layout_gravity="center_horizontal"
+        android:elevation="2dp"
+        android:orientation="horizontal">
+
+        <TextView
+            android:id="@+id/onboarding_text"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center_vertical"
+            android:textColor="@android:color/white"
+            android:textSize="16sp"/>
+        <ImageView
+            android:id="@+id/dismiss"
+            android:layout_width="40dp"
+            android:layout_height="40dp"
+            android:layout_gravity="center_vertical"
+            android:padding="10dp"
+            android:layout_marginStart="2dp"
+            android:layout_marginEnd="2dp"
+            android:alpha="0.7"
+            android:src="@drawable/ic_close_white"
+            android:background="?android:attr/selectableItemBackgroundBorderless"/>
+    </LinearLayout>
+
+    <View
+        android:id="@+id/arrow"
+        android:elevation="2dp"
+        android:layout_width="10dp"
+        android:layout_height="8dp"
+        android:layout_marginTop="-2dp"
+        android:layout_gravity="center_horizontal"/>
+</LinearLayout>
\ No newline at end of file
diff --git a/packages/SystemUI/res/values/attrs_car.xml b/packages/SystemUI/res/values/attrs_car.xml
index 335ae44..99d2425 100644
--- a/packages/SystemUI/res/values/attrs_car.xml
+++ b/packages/SystemUI/res/values/attrs_car.xml
@@ -29,6 +29,8 @@
         <attr name="categories" format="string"/>
         <!-- package names that will be added as extras to the fired intents -->
         <attr name="packages" format="string" />
+        <!-- componentName names that will be used for detecting selected state -->
+        <attr name="componentNames" format="string" />
         <!-- Alpha value to used when in selected state.  Defaults 1f  -->
         <attr name="selectedAlpha" format="float" />
         <!-- Alpha value to used when in un-selected state.  Defaults 0.7f  -->
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 9009531..9212c14 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -845,6 +845,9 @@
     <!-- The size of the drag hint text. -->
     <dimen name="recents_drag_hint_text_size">14sp</dimen>
 
+    <!-- The size of corner radius of the arrow in the onboarding toast. -->
+    <dimen name="recents_onboarding_toast_arrow_corner_radius">2dp</dimen>
+
     <!-- The min alpha to apply to a task affiliation group color. -->
     <item name="recents_task_affiliation_color_min_alpha_percentage" format="float" type="dimen">0.6</item>
 
@@ -930,6 +933,11 @@
     <dimen name="smart_reply_button_font_size">14sp</dimen>
     <dimen name="smart_reply_button_line_spacing_extra">6sp</dimen> <!-- Total line height 20sp. -->
 
+    <!-- A reasonable upper bound for the height of the smart reply button. The measuring code
+            needs to start with a guess for the maximum size. Currently two-line smart reply buttons
+            add about 88dp of height to the notifications. -->
+    <dimen name="smart_reply_button_max_height">100dp</dimen>
+
     <!-- Fingerprint Dialog values -->
     <dimen name="fingerprint_dialog_fp_icon_size">64dp</dimen>
     <dimen name="fingerprint_dialog_animation_translation_offset">350dp</dimen>
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index c1e1873..29f1335 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -405,7 +405,10 @@
     <string name="accessibility_cell_data_on">Mobile Data On</string>
 
     <!-- Content description of the cell data being disabled. [CHAR LIMIT=NONE] -->
-    <string name="cell_data_off">Mobile data off</string>
+    <string name="cell_data_off_content_description">Mobile data off</string>
+
+    <!-- Content description of the cell data being disabled but shortened. [CHAR LIMIT=20] -->
+    <string name="cell_data_off">Off</string>
 
     <!-- Content description of the bluetooth tethering icon for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
     <string name="accessibility_bluetooth_tether">Bluetooth tethering.</string>
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/WindowCallbacksCompat.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/WindowCallbacksCompat.java
index 36d8423..b2b140e 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/WindowCallbacksCompat.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/WindowCallbacksCompat.java
@@ -60,6 +60,12 @@
         }
     };
 
+    private final View mView;
+
+    public WindowCallbacksCompat(View view) {
+        mView = view;
+    }
+
     public void onWindowSizeIsChanging(Rect newBounds, boolean fullscreen, Rect systemInsets,
             Rect stableInsets) { }
 
@@ -72,12 +78,20 @@
         return false;
     }
 
-    public void onRequestDraw(boolean reportNextDraw) { }
+    public void onRequestDraw(boolean reportNextDraw) {
+        if (reportNextDraw) {
+            reportDrawFinish();
+        }
+    }
 
     public void onPostDraw(Canvas canvas) { }
 
-    public final boolean addToView(View view) {
-        ViewRootImpl root = view.getViewRootImpl();
+    public void reportDrawFinish() {
+        mView.getViewRootImpl().reportDrawFinish();
+    }
+
+    public boolean attach() {
+        ViewRootImpl root = mView.getViewRootImpl();
         if (root != null) {
             root.addWindowCallbacks(mWindowCallbacks);
             root.requestInvalidateRootRenderNode();
@@ -86,8 +100,8 @@
         return false;
     }
 
-    public final void removeFromView(View view) {
-        ViewRootImpl root = view.getViewRootImpl();
+    public void detach() {
+        ViewRootImpl root = mView.getViewRootImpl();
         if (root != null) {
             root.removeWindowCallbacks(mWindowCallbacks);
         }
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
index 1bab36b..c826aaa 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
@@ -1850,6 +1850,7 @@
         final TelephonyManager tele = TelephonyManager.from(mContext);
         ArrayList<Integer> changedSubscriptionIds = new ArrayList<>();
         HashSet<Integer> activeSubIds = new HashSet<>();
+        HashSet<Integer> activeSlotIds = new HashSet<>();
 
         for (SubscriptionInfo info : activeSubscriptionInfos) {
             int subId = info.getSubscriptionId();
@@ -1878,11 +1879,15 @@
             }
 
             activeSubIds.add(subId);
+            activeSlotIds.add(slotId);
         }
 
         for (SimData data : mSimDatas.values()) {
-            if (!activeSubIds.contains(data.subId) && data.simState != State.ABSENT) {
+            if (!activeSubIds.contains(data.subId)
+                && !activeSlotIds.contains(data.slotId)
+                && data.simState != State.ABSENT) {
                 // for the inactive subscriptions, reset state to ABSENT
+                if (DEBUG_SIM_STATES) Log.d(TAG, "reset state to ABSENT for subId:" + data.subId);
                 data.simState = State.ABSENT;
                 changedSubscriptionIds.add(data.subId);
             }
diff --git a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
index e54b083..7042d22 100644
--- a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
+++ b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
@@ -214,7 +214,11 @@
     }
 
     private boolean shouldDrawCutout() {
-        return mContext.getResources().getBoolean(
+        return shouldDrawCutout(mContext);
+    }
+
+    static boolean shouldDrawCutout(Context context) {
+        return context.getResources().getBoolean(
                 com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout);
     }
 
@@ -393,7 +397,7 @@
             mBoundingRect.setEmpty();
             mBoundingPath.reset();
             int newVisible;
-            if (hasCutout()) {
+            if (shouldDrawCutout(getContext()) && hasCutout()) {
                 mBounds.set(mInfo.displayCutout.getBounds());
                 localBounds(mBoundingRect);
                 updateBoundingPath();
diff --git a/packages/SystemUI/src/com/android/systemui/fingerprint/FingerprintDialogImpl.java b/packages/SystemUI/src/com/android/systemui/fingerprint/FingerprintDialogImpl.java
index c238e54..a81043e 100644
--- a/packages/SystemUI/src/com/android/systemui/fingerprint/FingerprintDialogImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/fingerprint/FingerprintDialogImpl.java
@@ -134,8 +134,11 @@
     }
 
     private void handleShowDialog(SomeArgs args) {
-        if (DEBUG) Log.d(TAG, "handleShowDialog");
-        if (mDialogShowing) {
+        if (DEBUG) Log.d(TAG, "handleShowDialog, isAnimatingAway: "
+                + mDialogView.isAnimatingAway());
+        if (mDialogView.isAnimatingAway()) {
+            mDialogView.forceRemove();
+        } else if (mDialogShowing) {
             Log.w(TAG, "Dialog already showing");
             return;
         }
@@ -168,7 +171,7 @@
     }
 
     private void handleHideDialog(boolean userCanceled) {
-        if (DEBUG) Log.d(TAG, "handleHideDialog");
+        if (DEBUG) Log.d(TAG, "handleHideDialog, userCanceled: " + userCanceled);
         if (!mDialogShowing) {
             // This can happen if there's a race and we get called from both
             // onAuthenticated and onError, etc.
diff --git a/packages/SystemUI/src/com/android/systemui/fingerprint/FingerprintDialogView.java b/packages/SystemUI/src/com/android/systemui/fingerprint/FingerprintDialogView.java
index d1d6609..8013a9e 100644
--- a/packages/SystemUI/src/com/android/systemui/fingerprint/FingerprintDialogView.java
+++ b/packages/SystemUI/src/com/android/systemui/fingerprint/FingerprintDialogView.java
@@ -19,7 +19,6 @@
 import android.content.Context;
 import android.graphics.Color;
 import android.graphics.PixelFormat;
-import android.graphics.PorterDuff;
 import android.graphics.drawable.AnimatedVectorDrawable;
 import android.graphics.drawable.Drawable;
 import android.hardware.biometrics.BiometricPrompt;
@@ -76,9 +75,29 @@
     private Bundle mBundle;
     private final LinearLayout mDialog;
     private int mLastState;
+    private boolean mAnimatingAway;
+    private boolean mWasForceRemoved;
 
     private final float mDisplayWidth;
 
+    private final Runnable mShowAnimationRunnable = new Runnable() {
+        @Override
+        public void run() {
+            mLayout.animate()
+                    .alpha(1f)
+                    .setDuration(ANIMATION_DURATION_SHOW)
+                    .setInterpolator(mLinearOutSlowIn)
+                    .withLayer()
+                    .start();
+            mDialog.animate()
+                    .translationY(0)
+                    .setDuration(ANIMATION_DURATION_SHOW)
+                    .setInterpolator(mLinearOutSlowIn)
+                    .withLayer()
+                    .start();
+        }
+    };
+
     public FingerprintDialogView(Context context, Handler handler) {
         super(context);
         mHandler = handler;
@@ -192,26 +211,20 @@
             positive.setVisibility(View.GONE);
         }
 
-        // Dim the background and slide the dialog up
-        mDialog.setTranslationY(mAnimationTranslationOffset);
-        mLayout.setAlpha(0f);
-        postOnAnimation(new Runnable() {
-            @Override
-            public void run() {
-                mLayout.animate()
-                        .alpha(1f)
-                        .setDuration(ANIMATION_DURATION_SHOW)
-                        .setInterpolator(mLinearOutSlowIn)
-                        .withLayer()
-                        .start();
-                mDialog.animate()
-                        .translationY(0)
-                        .setDuration(ANIMATION_DURATION_SHOW)
-                        .setInterpolator(mLinearOutSlowIn)
-                        .withLayer()
-                        .start();
-            }
-        });
+        if (!mWasForceRemoved) {
+            // Dim the background and slide the dialog up
+            mDialog.setTranslationY(mAnimationTranslationOffset);
+            mLayout.setAlpha(0f);
+            postOnAnimation(mShowAnimationRunnable);
+        } else {
+            // Show the dialog immediately
+            mLayout.animate().cancel();
+            mDialog.animate().cancel();
+            mDialog.setAlpha(1.0f);
+            mDialog.setTranslationY(0);
+            mLayout.setAlpha(1.0f);
+        }
+        mWasForceRemoved = false;
     }
 
     private void setDismissesDialog(View v) {
@@ -224,10 +237,13 @@
     }
 
     public void startDismiss() {
+        mAnimatingAway = true;
+
         final Runnable endActionRunnable = new Runnable() {
             @Override
             public void run() {
                 mWindowManager.removeView(FingerprintDialogView.this);
+                mAnimatingAway = false;
             }
         };
 
@@ -251,6 +267,23 @@
         });
     }
 
+    /**
+     * Force remove the window, cancelling any animation that's happening. This should only be
+     * called if we want to quickly show the dialog again (e.g. on rotation). Calling this method
+     * will cause the dialog to show without an animation the next time it's attached.
+     */
+    public void forceRemove() {
+        mLayout.animate().cancel();
+        mDialog.animate().cancel();
+        mWindowManager.removeView(FingerprintDialogView.this);
+        mAnimatingAway = false;
+        mWasForceRemoved = true;
+    }
+
+    public boolean isAnimatingAway() {
+        return mAnimatingAway;
+    }
+
     public void setBundle(Bundle bundle) {
         mBundle = bundle;
     }
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index 553b2ef..5993c39 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -145,6 +145,8 @@
     private static final String DELAYED_LOCK_PROFILE_ACTION =
             "com.android.internal.policy.impl.PhoneWindowManager.DELAYED_LOCK";
 
+    private static final String SYSTEMUI_PERMISSION = "com.android.systemui.permission.SELF";
+
     // used for handler messages
     private static final int SHOW = 1;
     private static final int HIDE = 2;
@@ -693,11 +695,15 @@
         mShowKeyguardWakeLock.setReferenceCounted(false);
 
         IntentFilter filter = new IntentFilter();
-        filter.addAction(DELAYED_KEYGUARD_ACTION);
-        filter.addAction(DELAYED_LOCK_PROFILE_ACTION);
         filter.addAction(Intent.ACTION_SHUTDOWN);
         mContext.registerReceiver(mBroadcastReceiver, filter);
 
+        final IntentFilter delayedActionFilter = new IntentFilter();
+        delayedActionFilter.addAction(DELAYED_KEYGUARD_ACTION);
+        delayedActionFilter.addAction(DELAYED_LOCK_PROFILE_ACTION);
+        mContext.registerReceiver(mDelayedLockBroadcastReceiver, delayedActionFilter,
+                SYSTEMUI_PERMISSION, null /* scheduler */);
+
         mKeyguardDisplayManager = new KeyguardDisplayManager(mContext, mViewMediatorCallback);
 
         mAlarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE);
@@ -1465,7 +1471,10 @@
         }
     }
 
-    private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
+    /**
+     * This broadcast receiver should be registered with the SystemUI permission.
+     */
+    private final BroadcastReceiver mDelayedLockBroadcastReceiver = new BroadcastReceiver() {
         @Override
         public void onReceive(Context context, Intent intent) {
             if (DELAYED_KEYGUARD_ACTION.equals(intent.getAction())) {
@@ -1487,7 +1496,14 @@
                         }
                     }
                 }
-            } else if (Intent.ACTION_SHUTDOWN.equals(intent.getAction())) {
+            }
+        }
+    };
+
+    private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
+        @Override
+        public void onReceive(Context context, Intent intent) {
+            if (Intent.ACTION_SHUTDOWN.equals(intent.getAction())) {
                 synchronized (KeyguardViewMediator.this){
                     mShuttingDown = true;
                 }
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java b/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java
index cf549fa..28dd26f 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java
@@ -383,7 +383,7 @@
             if (TextUtils.equals(mInfo.typeContentDescription,
                     mContext.getString(R.string.data_connection_no_internet))
                 || TextUtils.equals(mInfo.typeContentDescription,
-                    mContext.getString(R.string.cell_data_off))) {
+                    mContext.getString(R.string.cell_data_off_content_description))) {
                 contentDescription.append(mInfo.typeContentDescription);
             }
             mMobileSignal.setContentDescription(contentDescription);
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java
index 2abe9d9..d6182c4 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java
@@ -108,20 +108,21 @@
         }
         if (mDataController.isMobileDataEnabled()) {
             if (mKeyguardMonitor.isSecure() && !mKeyguardMonitor.canSkipBouncer()) {
-                mActivityStarter.postQSRunnableDismissingKeyguard(this::showDisableDialog);
+                mActivityStarter.postQSRunnableDismissingKeyguard(this::maybeShowDisableDialog);
             } else {
-                if (Prefs.getBoolean(mContext, QS_HAS_TURNED_OFF_MOBILE_DATA, false)) {
-                    mDataController.setMobileDataEnabled(false);
-                } else {
-                    mUiHandler.post(this::showDisableDialog);
-                }
+                mUiHandler.post(this::maybeShowDisableDialog);
             }
         } else {
             mDataController.setMobileDataEnabled(true);
         }
     }
 
-    private void showDisableDialog() {
+    private void maybeShowDisableDialog() {
+        if (Prefs.getBoolean(mContext, QS_HAS_TURNED_OFF_MOBILE_DATA, false)) {
+            // Directly turn off mobile data if the user has seen the dialog before.
+            mDataController.setMobileDataEnabled(false);
+            return;
+        }
         mHost.collapsePanels();
         String carrierName = mController.getMobileDataNetworkName();
         if (TextUtils.isEmpty(carrierName)) {
@@ -194,7 +195,18 @@
             state.state = Tile.STATE_INACTIVE;
             state.secondaryLabel = r.getString(R.string.cell_data_off);
         }
-        state.contentDescription = state.label + ", " + state.secondaryLabel;
+
+
+        // TODO(b/77881974): Instead of switching out the description via a string check for
+        // we need to have two strings provided by the MobileIconGroup.
+        final CharSequence contentDescriptionSuffix;
+        if (state.state == Tile.STATE_INACTIVE) {
+            contentDescriptionSuffix = r.getString(R.string.cell_data_off_content_description);
+        } else {
+            contentDescriptionSuffix = state.secondaryLabel;
+        }
+
+        state.contentDescription = state.label + ", " + contentDescriptionSuffix;
     }
 
     private CharSequence getMobileDataDescription(CallbackInfo cb) {
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java
index 4b312f5..16c2a75 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java
@@ -143,26 +143,41 @@
     public void showDetail(boolean show) {
         int zenDuration = Settings.Global.getInt(mContext.getContentResolver(),
                 Settings.Global.ZEN_DURATION, 0);
-        switch (zenDuration) {
-            case Settings.Global.ZEN_DURATION_PROMPT:
-                mUiHandler.post(() -> {
-                    Dialog mDialog = new EnableZenModeDialog(mContext).createDialog();
-                    mDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
-                    SystemUIDialog.setShowForAllUsers(mDialog, true);
-                    SystemUIDialog.registerDismissListener(mDialog);
-                    SystemUIDialog.setWindowOnTop(mDialog);
-                    mUiHandler.post(() -> mDialog.show());
-                    mHost.collapsePanels();
-                });
-                break;
-            case Settings.Global.ZEN_DURATION_FOREVER:
-                mController.setZen(Settings.Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS, null, TAG);
-                break;
-            default:
-                Uri conditionId = ZenModeConfig.toTimeCondition(mContext, zenDuration,
-                        ActivityManager.getCurrentUser(), true).id;
-                mController.setZen(Settings.Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS,
-                        conditionId, TAG);
+        boolean showOnboarding = Settings.Global.getInt(mContext.getContentResolver(),
+                Settings.Global.SHOW_ZEN_UPGRADE_NOTIFICATION, 0) != 0;
+        if (showOnboarding) {
+            // don't show on-boarding again or notification ever
+            Settings.Global.putInt(mContext.getContentResolver(),
+                    Global.SHOW_ZEN_UPGRADE_NOTIFICATION, 0);
+            // turn on DND
+            mController.setZen(Settings.Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS, null, TAG);
+            // show on-boarding screen
+            Intent intent = new Intent(Settings.ZEN_MODE_ONBOARDING);
+            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
+            Dependency.get(ActivityStarter.class).postStartActivityDismissingKeyguard(intent, 0);
+        } else {
+            switch (zenDuration) {
+                case Settings.Global.ZEN_DURATION_PROMPT:
+                    mUiHandler.post(() -> {
+                        Dialog mDialog = new EnableZenModeDialog(mContext).createDialog();
+                        mDialog.getWindow().setType(
+                                WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
+                        SystemUIDialog.setShowForAllUsers(mDialog, true);
+                        SystemUIDialog.registerDismissListener(mDialog);
+                        SystemUIDialog.setWindowOnTop(mDialog);
+                        mUiHandler.post(() -> mDialog.show());
+                        mHost.collapsePanels();
+                    });
+                    break;
+                case Settings.Global.ZEN_DURATION_FOREVER:
+                    mController.setZen(Settings.Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS, null, TAG);
+                    break;
+                default:
+                    Uri conditionId = ZenModeConfig.toTimeCondition(mContext, zenDuration,
+                            ActivityManager.getCurrentUser(), true).id;
+                    mController.setZen(Settings.Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS,
+                            conditionId, TAG);
+            }
         }
     }
 
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsOnboarding.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsOnboarding.java
index 30e9afd8..0d8aed4 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsOnboarding.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsOnboarding.java
@@ -24,15 +24,16 @@
 import android.content.Context;
 import android.content.res.Configuration;
 import android.content.res.Resources;
+import android.graphics.CornerPathEffect;
+import android.graphics.Paint;
 import android.graphics.PixelFormat;
-import android.graphics.PorterDuff;
-import android.graphics.drawable.ColorDrawable;
-import android.graphics.drawable.RippleDrawable;
+import android.graphics.drawable.ShapeDrawable;
 import android.os.Build;
 import android.os.SystemProperties;
 import android.os.UserManager;
 import android.text.TextUtils;
 import android.util.Log;
+import android.util.TypedValue;
 import android.view.Gravity;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -76,17 +77,13 @@
     private final View mLayout;
     private final TextView mTextView;
     private final ImageView mDismissView;
-    private final ColorDrawable mBackgroundDrawable;
-    private final int mDarkBackgroundColor;
-    private final int mLightBackgroundColor;
-    private final int mDarkContentColor;
-    private final int mLightContentColor;
-    private final RippleDrawable mDarkRipple;
-    private final RippleDrawable mLightRipple;
+    private final View mArrowView;
+    private final int mOnboardingToastColor;
+    private final int mOnboardingToastArrowRadius;
+    private int mNavBarHeight;
 
     private boolean mTaskListenerRegistered;
     private boolean mLayoutAttachedToWindow;
-    private boolean mBackgroundIsLight;
     private int mLastTaskId;
     private boolean mHasDismissed;
     private int mNumAppsLaunchedSinceDismiss;
@@ -159,24 +156,30 @@
         mLayout = LayoutInflater.from(mContext).inflate(R.layout.recents_onboarding, null);
         mTextView = mLayout.findViewById(R.id.onboarding_text);
         mDismissView = mLayout.findViewById(R.id.dismiss);
-        mDarkBackgroundColor = res.getColor(android.R.color.background_dark);
-        mLightBackgroundColor = res.getColor(android.R.color.background_light);
-        mDarkContentColor = res.getColor(R.color.primary_text_default_material_light);
-        mLightContentColor = res.getColor(R.color.primary_text_default_material_dark);
-        mDarkRipple = new RippleDrawable(res.getColorStateList(R.color.ripple_material_light),
-                null, null);
-        mLightRipple = new RippleDrawable(res.getColorStateList(R.color.ripple_material_dark),
-                null, null);
-        mBackgroundDrawable = new ColorDrawable(mDarkBackgroundColor);
+        mArrowView = mLayout.findViewById(R.id.arrow);
+
+        TypedValue typedValue = new TypedValue();
+        context.getTheme().resolveAttribute(android.R.attr.colorAccent, typedValue, true);
+        mOnboardingToastColor = res.getColor(typedValue.resourceId);
+        mOnboardingToastArrowRadius = res.getDimensionPixelSize(
+                R.dimen.recents_onboarding_toast_arrow_corner_radius);
 
         mLayout.addOnAttachStateChangeListener(mOnAttachStateChangeListener);
-        mLayout.setBackground(mBackgroundDrawable);
         mDismissView.setOnClickListener(v -> {
             hide(true);
             mHasDismissed = true;
             mNumAppsLaunchedSinceDismiss = 0;
         });
 
+        ViewGroup.LayoutParams arrowLp = mArrowView.getLayoutParams();
+        ShapeDrawable arrowDrawable = new ShapeDrawable(TriangleShape.create(
+                arrowLp.width, arrowLp.height, false));
+        Paint arrowPaint = arrowDrawable.getPaint();
+        arrowPaint.setColor(mOnboardingToastColor);
+        // The corner path effect won't be reflected in the shadow, but shouldn't be noticeable.
+        arrowPaint.setPathEffect(new CornerPathEffect(mOnboardingToastArrowRadius));
+        mArrowView.setBackground(arrowDrawable);
+
         if (RESET_PREFS_FOR_DEBUG) {
             Prefs.putBoolean(mContext, Prefs.Key.HAS_SEEN_RECENTS_ONBOARDING, false);
             Prefs.putInt(mContext, Prefs.Key.NUM_APPS_LAUNCHED, 0);
@@ -234,6 +237,7 @@
         int orientation = mContext.getResources().getConfiguration().orientation;
         if (!mLayoutAttachedToWindow && orientation == Configuration.ORIENTATION_PORTRAIT) {
             mLayout.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
+
             mWindowManager.addView(mLayout, getWindowLayoutParams());
             int layoutHeight = mLayout.getHeight();
             if (layoutHeight == 0) {
@@ -281,29 +285,18 @@
         }
     }
 
-    public void setContentDarkIntensity(float contentDarkIntensity) {
-        boolean backgroundIsLight = contentDarkIntensity > 0.5f;
-        if (backgroundIsLight != mBackgroundIsLight) {
-            mBackgroundIsLight = backgroundIsLight;
-            mBackgroundDrawable.setColor(mBackgroundIsLight
-                    ? mLightBackgroundColor : mDarkBackgroundColor);
-            int contentColor = mBackgroundIsLight ? mDarkContentColor : mLightContentColor;
-            mTextView.setTextColor(contentColor);
-            mTextView.getCompoundDrawables()[3].setColorFilter(contentColor,
-                    PorterDuff.Mode.SRC_IN);
-            mDismissView.setColorFilter(contentColor);
-            mDismissView.setBackground(mBackgroundIsLight ? mDarkRipple : mLightRipple);
-        }
+    public void setNavBarHeight(int navBarHeight) {
+        mNavBarHeight = navBarHeight;
     }
 
     private WindowManager.LayoutParams getWindowLayoutParams() {
-        int flags = WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
-                | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR
+        int flags = WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
                 | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
         final WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
                 ViewGroup.LayoutParams.MATCH_PARENT,
                 ViewGroup.LayoutParams.WRAP_CONTENT,
-                WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG,
+                0, -mNavBarHeight / 2,
+                WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY,
                 flags,
                 PixelFormat.TRANSLUCENT);
         lp.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS;
diff --git a/packages/SystemUI/src/com/android/systemui/recents/TriangleShape.java b/packages/SystemUI/src/com/android/systemui/recents/TriangleShape.java
new file mode 100644
index 0000000..de85c0f
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/recents/TriangleShape.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.recents;
+
+import android.graphics.Outline;
+import android.graphics.Path;
+import android.graphics.drawable.shapes.PathShape;
+import android.support.annotation.NonNull;
+
+/**
+ * Wrapper around {@link android.graphics.drawable.shapes.PathShape}
+ * that creates a shape with a triangular path (pointing up or down).
+ */
+public class TriangleShape extends PathShape {
+    private Path mTriangularPath;
+
+    public TriangleShape(Path path, float stdWidth, float stdHeight) {
+        super(path, stdWidth, stdHeight);
+        mTriangularPath = path;
+    }
+
+    public static TriangleShape create(float width, float height, boolean isPointingUp) {
+        Path triangularPath = new Path();
+        if (isPointingUp) {
+            triangularPath.moveTo(0, height);
+            triangularPath.lineTo(width, height);
+            triangularPath.lineTo(width / 2, 0);
+            triangularPath.close();
+        } else {
+            triangularPath.moveTo(0, 0);
+            triangularPath.lineTo(width / 2, height);
+            triangularPath.lineTo(width, 0);
+            triangularPath.close();
+        }
+        return new TriangleShape(triangularPath, width, height);
+    }
+
+    @Override
+    public void getOutline(@NonNull Outline outline) {
+        outline.setConvexPath(mTriangularPath);
+    }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
index 4256cd6..8030bde 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
@@ -80,6 +80,7 @@
     private RemoteInputView mHeadsUpRemoteInput;
 
     private SmartReplyConstants mSmartReplyConstants;
+    private SmartReplyView mExpandedSmartReplyView;
     private SmartReplyLogger mSmartReplyLogger;
 
     private NotificationViewWrapper mContractedWrapper;
@@ -184,7 +185,11 @@
         }
         int maxChildHeight = 0;
         if (mExpandedChild != null) {
-            int size = Math.min(maxSize, mNotificationMaxHeight);
+            int notificationMaxHeight = mNotificationMaxHeight;
+            if (mExpandedSmartReplyView != null) {
+                notificationMaxHeight += mExpandedSmartReplyView.getHeightUpperLimit();
+            }
+            int size = Math.min(maxSize, notificationMaxHeight);
             ViewGroup.LayoutParams layoutParams = mExpandedChild.getLayoutParams();
             boolean useExactly = false;
             if (layoutParams.height >= 0) {
@@ -1348,10 +1353,10 @@
     private void applySmartReplyView(RemoteInput remoteInput, PendingIntent pendingIntent,
             NotificationData.Entry entry) {
         if (mExpandedChild != null) {
-            SmartReplyView view =
+            mExpandedSmartReplyView =
                     applySmartReplyView(mExpandedChild, remoteInput, pendingIntent, entry);
-            if (view != null && remoteInput != null && remoteInput.getChoices() != null
-                    && remoteInput.getChoices().length > 0) {
+            if (mExpandedSmartReplyView != null && remoteInput != null
+                    && remoteInput.getChoices() != null && remoteInput.getChoices().length > 0) {
                 mSmartReplyLogger.smartRepliesAdded(entry, remoteInput.getChoices().length);
             }
         }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/car/CarFacetButton.java b/packages/SystemUI/src/com/android/systemui/statusbar/car/CarFacetButton.java
index 7285db6..46f8863 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/car/CarFacetButton.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/car/CarFacetButton.java
@@ -4,6 +4,7 @@
 import android.content.Intent;
 import android.content.res.TypedArray;
 import android.graphics.drawable.Drawable;
+import android.os.UserHandle;
 import android.util.AttributeSet;
 import android.util.Log;
 import android.view.View;
@@ -37,6 +38,7 @@
     private AlphaOptimizedImageButton mIcon;
     private AlphaOptimizedImageButton mMoreIcon;
     private boolean mSelected = false;
+    private String[] mComponentNames;
     /** App categories that are to be used with this widget */
     private String[] mFacetCategories;
     /** App packages that are allowed to be used with this widget */
@@ -75,6 +77,8 @@
         String longPressIntentString = typedArray.getString(R.styleable.CarFacetButton_longIntent);
         String categoryString = typedArray.getString(R.styleable.CarFacetButton_categories);
         String packageString = typedArray.getString(R.styleable.CarFacetButton_packages);
+        String componentNameString =
+                typedArray.getString(R.styleable.CarFacetButton_componentNames);
         try {
             final Intent intent = Intent.parseUri(intentString, Intent.URI_INTENT_SCHEME);
             intent.putExtra(EXTRA_FACET_ID, Integer.toString(getId()));
@@ -87,17 +91,20 @@
                 mFacetCategories = categoryString.split(FACET_FILTER_DELIMITER);
                 intent.putExtra(EXTRA_FACET_CATEGORIES, mFacetCategories);
             }
+            if (componentNameString != null) {
+                mComponentNames = componentNameString.split(FACET_FILTER_DELIMITER);
+            }
 
             setOnClickListener(v -> {
                 intent.putExtra(EXTRA_FACET_LAUNCH_PICKER, mSelected);
-                mContext.startActivity(intent);
+                mContext.startActivityAsUser(intent, UserHandle.CURRENT);
             });
 
             if (longPressIntentString != null) {
                 final Intent longPressIntent = Intent.parseUri(longPressIntentString,
                         Intent.URI_INTENT_SCHEME);
                 setOnLongClickListener(v -> {
-                    mContext.startActivity(longPressIntent);
+                    mContext.startActivityAsUser(longPressIntent, UserHandle.CURRENT);
                     return true;
                 });
             }
@@ -148,6 +155,13 @@
         return mFacetPackages;
     }
 
+    public String[] getComponentName() {
+        if (mComponentNames == null) {
+            return new String[0];
+        }
+        return mComponentNames;
+    }
+
     /**
      * Updates the alpha of the icons to "selected" and shows the "More icon"
      * @param selected true if the view must be selected, false otherwise
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/car/CarFacetButtonController.java b/packages/SystemUI/src/com/android/systemui/statusbar/car/CarFacetButtonController.java
index b7d501e..2d30ce1 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/car/CarFacetButtonController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/car/CarFacetButtonController.java
@@ -1,10 +1,12 @@
 package com.android.systemui.statusbar.car;
 
 import android.app.ActivityManager;
+import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
+import android.util.Log;
 
 import java.util.HashMap;
 import java.util.List;
@@ -19,6 +21,7 @@
 
     protected HashMap<String, CarFacetButton> mButtonsByCategory = new HashMap<>();
     protected HashMap<String, CarFacetButton> mButtonsByPackage = new HashMap<>();
+    protected HashMap<String, CarFacetButton> mButtonsByComponentName = new HashMap<>();
     protected CarFacetButton mSelectedFacetButton;
     protected Context mContext;
 
@@ -34,28 +37,32 @@
      */
     public void addFacetButton(CarFacetButton facetButton) {
         String[] categories = facetButton.getCategories();
-        for (int j = 0; j < categories.length; j++) {
-            String category = categories[j];
-            mButtonsByCategory.put(category, facetButton);
+        for (int i = 0; i < categories.length; i++) {
+            mButtonsByCategory.put(categories[i], facetButton);
         }
 
         String[] facetPackages = facetButton.getFacetPackages();
-        for (int j = 0; j < facetPackages.length; j++) {
-            String facetPackage = facetPackages[j];
-            mButtonsByPackage.put(facetPackage, facetButton);
+        for (int i = 0; i < facetPackages.length; i++) {
+            mButtonsByPackage.put(facetPackages[i], facetButton);
+        }
+        String[] componentNames = facetButton.getComponentName();
+        for (int i = 0; i < componentNames.length; i++) {
+            mButtonsByComponentName.put(componentNames[i], facetButton);
         }
     }
 
     public void removeAll() {
         mButtonsByCategory.clear();
         mButtonsByPackage.clear();
+        mButtonsByComponentName.clear();
         mSelectedFacetButton = null;
     }
 
     /**
      * This will unselect the currently selected CarFacetButton and determine which one should be
      * selected next. It does this by reading the properties on the CarFacetButton and seeing if
-     * they are a match with the supplied taskino.
+     * they are a match with the supplied taskInfo.
+     * Order of selection detection ComponentName, PackageName, Category
      * @param taskInfo of the currently running application
      */
     public void taskChanged(ActivityManager.RunningTaskInfo taskInfo) {
@@ -69,7 +76,10 @@
         if (mSelectedFacetButton != null) {
             mSelectedFacetButton.setSelected(false);
         }
-        CarFacetButton facetButton = mButtonsByPackage.get(packageName);
+        CarFacetButton facetButton = findFacetButtongByComponentName(taskInfo.topActivity);
+        if (facetButton == null) {
+            facetButton =  mButtonsByPackage.get(packageName);
+        }
         if (facetButton != null) {
             facetButton.setSelected(true);
             mSelectedFacetButton = facetButton;
@@ -83,6 +93,12 @@
         }
     }
 
+    private CarFacetButton findFacetButtongByComponentName(ComponentName componentName) {
+        CarFacetButton button = mButtonsByComponentName.get(componentName.flattenToShortString());
+        return (button != null) ? button :
+                mButtonsByComponentName.get(componentName.flattenToString());
+    }
+
     protected String getPackageCategory(String packageName) {
         PackageManager pm = mContext.getPackageManager();
         Set<String> supportedCategories = mButtonsByCategory.keySet();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/car/CarNavigationButton.java b/packages/SystemUI/src/com/android/systemui/statusbar/car/CarNavigationButton.java
index ec243fe..084c136 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/car/CarNavigationButton.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/car/CarNavigationButton.java
@@ -3,6 +3,7 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.res.TypedArray;
+import android.os.UserHandle;
 import android.util.AttributeSet;
 import android.util.Log;
 import android.widget.ImageView;
@@ -64,10 +65,10 @@
                 setOnClickListener(v -> {
                     try {
                         if (mBroadcastIntent) {
-                            mContext.sendBroadcast(intent);
+                            mContext.sendBroadcastAsUser(intent, UserHandle.CURRENT);
                             return;
                         }
-                        mContext.startActivity(intent);
+                        mContext.startActivityAsUser(intent, UserHandle.CURRENT);
                     } catch (Exception e) {
                         Log.e(TAG, "Failed to launch intent", e);
                     }
@@ -82,7 +83,7 @@
                 final Intent intent = Intent.parseUri(mLongIntent, Intent.URI_INTENT_SCHEME);
                 setOnLongClickListener(v -> {
                     try {
-                        mContext.startActivity(intent);
+                        mContext.startActivityAsUser(intent, UserHandle.CURRENT);
                     } catch (Exception e) {
                         Log.e(TAG, "Failed to launch intent", e);
                     }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/car/FullscreenUserSwitcher.java b/packages/SystemUI/src/com/android/systemui/statusbar/car/FullscreenUserSwitcher.java
index fb525f7..5a02d18 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/car/FullscreenUserSwitcher.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/car/FullscreenUserSwitcher.java
@@ -37,19 +37,20 @@
     private final UserGridRecyclerView mUserGridView;
     private final ProgressBar mSwitchingUsers;
     private final int mShortAnimDuration;
+    private final StatusBar mStatusBar;
 
     private boolean mShowing;
 
     public FullscreenUserSwitcher(StatusBar statusBar, ViewStub containerStub, Context context) {
+        mStatusBar = statusBar;
         mParent = containerStub.inflate();
         mContainer = mParent.findViewById(R.id.container);
         mUserGridView = mContainer.findViewById(R.id.user_grid);
-        mUserGridView.setStatusBar(statusBar);
         GridLayoutManager layoutManager = new GridLayoutManager(context,
                 context.getResources().getInteger(R.integer.user_fullscreen_switcher_num_col));
         mUserGridView.setLayoutManager(layoutManager);
         mUserGridView.buildAdapter();
-        mUserGridView.setUserSelectionListener(record -> toggleSwitchInProgress(true));
+        mUserGridView.setUserSelectionListener(this::onUserSelected);
 
         mShortAnimDuration = mContainer.getResources()
             .getInteger(android.R.integer.config_shortAnimTime);
@@ -57,8 +58,35 @@
         mSwitchingUsers = mParent.findViewById(R.id.switching_users);
     }
 
+    public void show() {
+        if (mShowing) {
+            return;
+        }
+        mShowing = true;
+        mParent.setVisibility(View.VISIBLE);
+    }
+
+    public void hide() {
+        mShowing = false;
+        toggleSwitchInProgress(false);
+        mParent.setVisibility(View.GONE);
+    }
+
     public void onUserSwitched(int newUserId) {
-        mUserGridView.onUserSwitched(newUserId);
+        mParent.post(this::showOfflineAuthUi);
+    }
+
+    private void onUserSelected(UserGridRecyclerView.UserRecord record) {
+        if (record.mIsForeground) {
+            showOfflineAuthUi();
+            return;
+        }
+        toggleSwitchInProgress(true);
+    }
+
+    private void showOfflineAuthUi() {
+        mStatusBar.executeRunnableDismissingKeyguard(null/* runnable */, null /* cancelAction */,
+                true /* dismissShade */, true /* afterKeyguardGone */, true /* deferred */);
     }
 
     private void toggleSwitchInProgress(boolean inProgress) {
@@ -91,18 +119,4 @@
                 }
             });
     }
-
-    public void show() {
-        if (mShowing) {
-            return;
-        }
-        mShowing = true;
-        mParent.setVisibility(View.VISIBLE);
-    }
-
-    public void hide() {
-        mShowing = false;
-        toggleSwitchInProgress(false);
-        mParent.setVisibility(View.GONE);
-    }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/car/UserGridRecyclerView.java b/packages/SystemUI/src/com/android/systemui/statusbar/car/UserGridRecyclerView.java
index e09a360..5ad08ac 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/car/UserGridRecyclerView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/car/UserGridRecyclerView.java
@@ -38,8 +38,6 @@
 
 import com.android.settingslib.users.UserManagerHelper;
 import com.android.systemui.R;
-import com.android.systemui.qs.car.CarQSFragment;
-import com.android.systemui.statusbar.phone.StatusBar;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -50,8 +48,6 @@
  */
 public class UserGridRecyclerView extends RecyclerView implements
         UserManagerHelper.OnUsersUpdateListener {
-
-    private StatusBar mStatusBar;
     private UserSelectionListener mUserSelectionListener;
     private UserAdapter mAdapter;
     private UserManagerHelper mUserManagerHelper;
@@ -92,29 +88,22 @@
         super.setAdapter(mAdapter);
     }
 
-    public void setStatusBar(@Nullable StatusBar statusBar) {
-        mStatusBar = statusBar;
-    }
-
     private List<UserRecord> createUserRecords(List<UserInfo> userInfoList) {
         List<UserRecord> userRecords = new ArrayList<>();
         for (UserInfo userInfo : userInfoList) {
-            boolean isCurrent = false;
-            if (ActivityManager.getCurrentUser() == userInfo.id) {
-                isCurrent = true;
-            }
+            boolean isForeground = mUserManagerHelper.getForegroundUserId() == userInfo.id;
             UserRecord record = new UserRecord(userInfo, false /* isGuest */,
-                    false /* isAddUser */, isCurrent);
+                    false /* isAddUser */, isForeground);
             userRecords.add(record);
         }
 
-        // Add guest user record if the current user is not a guest
-        if (!mUserManagerHelper.isGuestUser()) {
+        // Add guest user record if the foreground user is not a guest
+        if (!mUserManagerHelper.foregroundUserIsGuestUser()) {
             userRecords.add(addGuestUserRecord());
         }
 
-        // Add add user record if the current user can add users
-        if (mUserManagerHelper.canAddUsers()) {
+        // Add add user record if the foreground user can add users
+        if (mUserManagerHelper.foregroundUserCanAddUsers()) {
             userRecords.add(addUserRecord());
         }
 
@@ -128,7 +117,7 @@
         UserInfo userInfo = new UserInfo();
         userInfo.name = mContext.getString(R.string.car_guest);
         return new UserRecord(userInfo, true /* isGuest */,
-                false /* isAddUser */, false /* isCurrent */);
+                false /* isAddUser */, false /* isForeground */);
     }
 
     /**
@@ -138,26 +127,13 @@
         UserInfo userInfo = new UserInfo();
         userInfo.name = mContext.getString(R.string.car_add_user);
         return new UserRecord(userInfo, false /* isGuest */,
-                true /* isAddUser */, false /* isCurrent */);
-    }
-
-    public void onUserSwitched(int newUserId) {
-        // Bring up security view after user switch is completed.
-        post(this::showOfflineAuthUi);
+                true /* isAddUser */, false /* isForeground */);
     }
 
     public void setUserSelectionListener(UserSelectionListener userSelectionListener) {
         mUserSelectionListener = userSelectionListener;
     }
 
-    void showOfflineAuthUi() {
-        // TODO: Show keyguard UI in-place.
-        if (mStatusBar != null) {
-            mStatusBar.executeRunnableDismissingKeyguard(null/* runnable */, null /* cancelAction */,
-                    true /* dismissShade */, true /* afterKeyguardGone */, true /* deferred */);
-        }
-    }
-
     @Override
     public void onUsersUpdate() {
         mAdapter.clearUsers();
@@ -332,21 +308,21 @@
 
     /**
      * Object wrapper class for the userInfo.  Use it to distinguish if a profile is a
-     * guest profile, add user profile, or a current user.
+     * guest profile, add user profile, or the foreground user.
      */
     public static final class UserRecord {
 
         public final UserInfo mInfo;
         public final boolean mIsGuest;
         public final boolean mIsAddUser;
-        public final boolean mIsCurrent;
+        public final boolean mIsForeground;
 
         public UserRecord(UserInfo userInfo, boolean isGuest, boolean isAddUser,
-                boolean isCurrent) {
+                boolean isForeground) {
             mInfo = userInfo;
             mIsGuest = isGuest;
             mIsAddUser = isAddUser;
-            mIsCurrent = isCurrent;
+            mIsForeground = isForeground;
         }
     }
 
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java
index 9894235..91cf8f0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java
@@ -25,6 +25,7 @@
 import android.view.Display.Mode;
 import android.view.Gravity;
 import android.view.LayoutInflater;
+import android.view.Surface;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.WindowManager;
@@ -80,6 +81,7 @@
     private static final String WEIGHT_CENTERED_SUFFIX = "WC";
 
     private final List<NavBarButtonProvider> mPlugins = new ArrayList<>();
+    private final Display mDisplay;
 
     protected LayoutInflater mLayoutInflater;
     protected LayoutInflater mLandscapeInflater;
@@ -99,9 +101,9 @@
     public NavigationBarInflaterView(Context context, AttributeSet attrs) {
         super(context, attrs);
         createInflaters();
-        Display display = ((WindowManager)
+        mDisplay = ((WindowManager)
                 context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
-        Mode displayMode = display.getMode();
+        Mode displayMode = mDisplay.getMode();
         isRot0Landscape = displayMode.getPhysicalWidth() > displayMode.getPhysicalHeight();
     }
 
@@ -173,6 +175,17 @@
         }
     }
 
+    public void updateButtonDispatchersCurrentView() {
+        if (mButtonDispatchers != null) {
+            final int rotation = mDisplay.getRotation();
+            final View view = rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_180
+                    ? mRot0 : mRot90;
+            for (int i = 0; i < mButtonDispatchers.size(); i++) {
+                mButtonDispatchers.valueAt(i).setCurrentView(view);
+            }
+        }
+    }
+
     public void setAlternativeOrder(boolean alternativeOrder) {
         if (alternativeOrder != mAlternativeOrder) {
             mAlternativeOrder = alternativeOrder;
@@ -239,6 +252,8 @@
 
         inflateButtons(end, mRot0.findViewById(R.id.ends_group), isRot0Landscape, false);
         inflateButtons(end, mRot90.findViewById(R.id.ends_group), !isRot0Landscape, false);
+
+        updateButtonDispatchersCurrentView();
     }
 
     private void addGravitySpacer(LinearLayout layout) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
index db2139d..d79f308 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
@@ -812,9 +812,6 @@
         if (mGestureHelper != null) {
             mGestureHelper.onDarkIntensityChange(intensity);
         }
-        if (mRecentsOnboarding != null) {
-            mRecentsOnboarding.setContentDarkIntensity(intensity);
-        }
     }
 
     @Override
@@ -831,6 +828,7 @@
         updateButtonLocationOnScreen(getHomeButton(), mHomeButtonBounds);
         updateButtonLocationOnScreen(getRecentsButton(), mRecentsButtonBounds);
         mGestureHelper.onLayout(changed, left, top, right, bottom);
+        mRecentsOnboarding.setNavBarHeight(getMeasuredHeight());
     }
 
     private void updateButtonLocationOnScreen(ButtonDispatcher button, Rect buttonBounds) {
@@ -873,9 +871,7 @@
         mCurrentView = mRotatedViews[rot];
         mCurrentView.setVisibility(View.VISIBLE);
         mNavigationInflaterView.setAlternativeOrder(rot == Surface.ROTATION_90);
-        for (int i = 0; i < mButtonDispatchers.size(); i++) {
-            mButtonDispatchers.valueAt(i).setCurrentView(mCurrentView);
-        }
+        mNavigationInflaterView.updateButtonDispatchersCurrentView();
         updateLayoutTransitionsEnabled();
         mCurrentRotation = rot;
     }
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 4b2bc45..a3da807 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -1193,12 +1193,10 @@
 
     public void manageNotifications() {
         Intent intent = new Intent(Settings.ACTION_ALL_APPS_NOTIFICATION_SETTINGS);
-        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-        startActivity(intent, true, true);
+        startActivity(intent, true, true, Intent.FLAG_ACTIVITY_SINGLE_TOP);
     }
 
     public void clearAllNotifications() {
-
         // animate-swipe all dismissable notifications, then animate the shade closed
         int numChildren = mStackScroller.getChildCount();
 
@@ -1838,6 +1836,11 @@
         return new StatusBar.H();
     }
 
+    private void startActivity(Intent intent, boolean onlyProvisioned, boolean dismissShade,
+            int flags) {
+        startActivityDismissingKeyguard(intent, onlyProvisioned, dismissShade, flags);
+    }
+
     @Override
     public void startActivity(Intent intent, boolean dismissShade) {
         startActivityDismissingKeyguard(intent, false, dismissShade);
@@ -1851,7 +1854,7 @@
     @Override
     public void startActivity(Intent intent, boolean dismissShade, Callback callback) {
         startActivityDismissingKeyguard(intent, false, dismissShade,
-                false /* disallowEnterPictureInPictureWhileLaunching */, callback);
+                false /* disallowEnterPictureInPictureWhileLaunching */, callback, 0);
     }
 
     public void setQsExpanded(boolean expanded) {
@@ -2874,14 +2877,20 @@
     }
 
     public void startActivityDismissingKeyguard(final Intent intent, boolean onlyProvisioned,
-            boolean dismissShade) {
+            boolean dismissShade, int flags) {
         startActivityDismissingKeyguard(intent, onlyProvisioned, dismissShade,
-                false /* disallowEnterPictureInPictureWhileLaunching */, null /* callback */);
+                false /* disallowEnterPictureInPictureWhileLaunching */, null /* callback */,
+                flags);
+    }
+
+    public void startActivityDismissingKeyguard(final Intent intent, boolean onlyProvisioned,
+            boolean dismissShade) {
+        startActivityDismissingKeyguard(intent, onlyProvisioned, dismissShade, 0);
     }
 
     public void startActivityDismissingKeyguard(final Intent intent, boolean onlyProvisioned,
             final boolean dismissShade, final boolean disallowEnterPictureInPictureWhileLaunching,
-            final Callback callback) {
+            final Callback callback, int flags) {
         if (onlyProvisioned && !isDeviceProvisioned()) return;
 
         final boolean afterKeyguardGone = PreviewInflater.wouldLaunchResolverActivity(
@@ -2890,6 +2899,7 @@
             mAssistManager.hideAssist();
             intent.setFlags(
                     Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
+            intent.addFlags(flags);
             int result = ActivityManager.START_CANCELED;
             ActivityOptions options = new ActivityOptions(getActivityOptions(
                     null /* remoteAnimation */));
@@ -4575,7 +4585,7 @@
         if (!mStatusBarKeyguardViewManager.isShowing()) {
             startActivityDismissingKeyguard(KeyguardBottomAreaView.INSECURE_CAMERA_INTENT,
                     false /* onlyProvisioned */, true /* dismissShade */,
-                    true /* disallowEnterPictureInPictureWhileLaunching */, null /* callback */);
+                    true /* disallowEnterPictureInPictureWhileLaunching */, null /* callback */, 0);
         } else {
             if (!mDeviceInteractive) {
                 // Avoid flickering of the scrim when we instant launch the camera and the bouncer
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java
index 4c79ee3..6d2f5ce 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java
@@ -25,6 +25,7 @@
 import com.android.systemui.R;
 import com.android.systemui.statusbar.NotificationData;
 import com.android.systemui.statusbar.SmartReplyLogger;
+import com.android.systemui.statusbar.notification.NotificationUtils;
 import com.android.systemui.statusbar.phone.KeyguardDismissUtil;
 
 import java.text.BreakIterator;
@@ -48,6 +49,12 @@
     private final SmartReplyConstants mConstants;
     private final KeyguardDismissUtil mKeyguardDismissUtil;
 
+    /**
+     * The upper bound for the height of this view in pixels. Notifications are automatically
+     * recreated on density or font size changes so caching this should be fine.
+     */
+    private final int mHeightUpperLimit;
+
     /** Spacing to be applied between views. */
     private final int mSpacing;
 
@@ -69,6 +76,9 @@
         mConstants = Dependency.get(SmartReplyConstants.class);
         mKeyguardDismissUtil = Dependency.get(KeyguardDismissUtil.class);
 
+        mHeightUpperLimit = NotificationUtils.getFontScaledHeight(mContext,
+            R.dimen.smart_reply_button_max_height);
+
         int spacing = 0;
         int singleLineButtonPaddingHorizontal = 0;
         int doubleLineButtonPaddingHorizontal = 0;
@@ -98,10 +108,19 @@
         mSingleToDoubleLineButtonWidthIncrease =
                 2 * (doubleLineButtonPaddingHorizontal - singleLineButtonPaddingHorizontal);
 
+
         mBreakIterator = BreakIterator.getLineInstance();
         reallocateCandidateButtonQueueForSqueezing();
     }
 
+    /**
+     * Returns an upper bound for the height of this view in pixels. This method is intended to be
+     * invoked before onMeasure, so it doesn't do any analysis on the contents of the buttons.
+     */
+    public int getHeightUpperLimit() {
+       return mHeightUpperLimit;
+    }
+
     private void reallocateCandidateButtonQueueForSqueezing() {
         // Instead of clearing the priority queue, we re-allocate so that it would fit all buttons
         // exactly. This avoids (1) wasting memory because PriorityQueue never shrinks and
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java
index 7e6fe02..bd76820 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java
@@ -208,7 +208,7 @@
             0,
             0,
             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
-            R.string.cell_data_off,
+            R.string.cell_data_off_content_description,
             0,
             false);
 }
diff --git a/proto/src/metrics_constants.proto b/proto/src/metrics_constants.proto
index daf4e9b..72496d2 100644
--- a/proto/src/metrics_constants.proto
+++ b/proto/src/metrics_constants.proto
@@ -5644,6 +5644,20 @@
     // OS: P
     ACTION_VOLUME_SETTINGS = 1386;
 
+    // ACTION: Settings > Anomaly receiver > Anomaly ignored, don't show up in battery settings
+    // CATEGORY: SETTINGS
+    // OS: P
+    ACTION_ANOMALY_IGNORED = 1387;
+
+    // ACTION: Settings > Battery settings > Battery tip > Open battery saver page
+    // CATEGORY: SETTINGS
+    // OS: P
+    ACTION_TIP_OPEN_BATTERY_SAVER_PAGE = 1388;
+
+    // FIELD: the version code of an app
+    // CATEGORY: SETTINGS
+    // OS: P
+    FIELD_APP_VERSION_CODE = 1389;
 
     // ---- End P Constants, all P constants go above this line ----
     // Add new aosp constants above this line.
diff --git a/services/backup/java/com/android/server/backup/PackageManagerBackupAgent.java b/services/backup/java/com/android/server/backup/PackageManagerBackupAgent.java
index dc28cd1..e4ce62d 100644
--- a/services/backup/java/com/android/server/backup/PackageManagerBackupAgent.java
+++ b/services/backup/java/com/android/server/backup/PackageManagerBackupAgent.java
@@ -27,6 +27,7 @@
 import android.content.pm.ResolveInfo;
 import android.content.pm.PackageManager.NameNotFoundException;
 import android.content.pm.Signature;
+import android.content.pm.SigningInfo;
 import android.os.Build;
 import android.os.ParcelFileDescriptor;
 import android.util.Slog;
@@ -240,12 +241,13 @@
                         PackageManager.GET_SIGNING_CERTIFICATES);
                 homeInstaller = mPackageManager.getInstallerPackageName(home.getPackageName());
                 homeVersion = homeInfo.getLongVersionCode();
-                Signature[][] signingHistory = homeInfo.signingCertificateHistory;
-                if (signingHistory == null || signingHistory.length == 0) {
-                    Slog.e(TAG, "Home app has no signing history");
+                SigningInfo signingInfo = homeInfo.signingInfo;
+                if (signingInfo == null) {
+                    Slog.e(TAG, "Home app has no signing information");
                 } else {
                     // retrieve the newest sigs to back up
-                    Signature[] homeInfoSignatures = signingHistory[signingHistory.length - 1];
+                    // TODO (b/73988180) use entire signing history in case of rollbacks
+                    Signature[] homeInfoSignatures = signingInfo.getApkContentsSigners();
                     homeSigHashes = BackupUtils.hashSignatureArray(homeInfoSignatures);
                 }
             } catch (NameNotFoundException e) {
@@ -334,8 +336,8 @@
                         }
                     }
 
-                    Signature[][] signingHistory = info.signingCertificateHistory;
-                    if (signingHistory == null || signingHistory.length == 0) {
+                    SigningInfo signingInfo = info.signingInfo;
+                    if (signingInfo == null) {
                         Slog.w(TAG, "Not backing up package " + packName
                                 + " since it appears to have no signatures.");
                         continue;
@@ -358,7 +360,7 @@
                         outputBufferStream.writeInt(info.versionCode);
                     }
                     // retrieve the newest sigs to back up
-                    Signature[] infoSignatures = signingHistory[signingHistory.length - 1];
+                    Signature[] infoSignatures = signingInfo.getApkContentsSigners();
                     writeSignatureHashArray(outputBufferStream,
                             BackupUtils.hashSignatureArray(infoSignatures));
 
diff --git a/services/backup/java/com/android/server/backup/internal/PerformBackupTask.java b/services/backup/java/com/android/server/backup/internal/PerformBackupTask.java
index ac605b1..90baea0 100644
--- a/services/backup/java/com/android/server/backup/internal/PerformBackupTask.java
+++ b/services/backup/java/com/android/server/backup/internal/PerformBackupTask.java
@@ -528,7 +528,7 @@
                     // we're otherwise fine.  Just drop it and go on to the next as usual.
                     mStatus = BackupTransport.TRANSPORT_OK;
                     BackupObserverUtils
-                            .sendBackupOnPackageResult(mObserver, mCurrentPackage.packageName,
+                            .sendBackupOnPackageResult(mObserver, request.packageName,
                                     BackupManager.ERROR_PACKAGE_NOT_FOUND);
                 } else {
                     // Transport-level failure means we reenqueue everything
diff --git a/services/backup/java/com/android/server/backup/utils/AppBackupUtils.java b/services/backup/java/com/android/server/backup/utils/AppBackupUtils.java
index 5518374..c39cceb 100644
--- a/services/backup/java/com/android/server/backup/utils/AppBackupUtils.java
+++ b/services/backup/java/com/android/server/backup/utils/AppBackupUtils.java
@@ -27,6 +27,7 @@
 import android.content.pm.PackageManager;
 import android.content.pm.PackageManagerInternal;
 import android.content.pm.Signature;
+import android.content.pm.SigningInfo;
 import android.os.Process;
 import android.util.Slog;
 
@@ -203,15 +204,16 @@
             return false;
         }
 
-        Signature[][] deviceHistorySigs = target.signingCertificateHistory;
-        if (ArrayUtils.isEmpty(deviceHistorySigs)) {
-            Slog.w(TAG, "signingCertificateHistory is empty, app was either unsigned or the flag" +
+        SigningInfo signingInfo = target.signingInfo;
+        if (signingInfo == null) {
+            Slog.w(TAG, "signingInfo is empty, app was either unsigned or the flag" +
                     " PackageManager#GET_SIGNING_CERTIFICATES was not specified");
             return false;
         }
 
         if (DEBUG) {
-            Slog.v(TAG, "signaturesMatch(): stored=" + storedSigs + " device=" + deviceHistorySigs);
+            Slog.v(TAG, "signaturesMatch(): stored=" + storedSigs + " device="
+                    + signingInfo.getApkContentsSigners());
         }
 
         final int nStored = storedSigs.length;
@@ -225,8 +227,8 @@
         } else {
             // the app couldn't have rotated keys, since it was signed with multiple sigs - do
             // a check to see if we find a match for all stored sigs
-            // since app hasn't rotated key, we only need to check with deviceHistorySigs[0]
-            Signature[] deviceSigs = deviceHistorySigs[0];
+            // since app hasn't rotated key, we only need to check with its current signers
+            Signature[] deviceSigs = signingInfo.getApkContentsSigners();
             int nDevice = deviceSigs.length;
 
             // ensure that each stored sig matches an on-device sig
diff --git a/services/backup/java/com/android/server/backup/utils/FullBackupUtils.java b/services/backup/java/com/android/server/backup/utils/FullBackupUtils.java
index 994d5a9..a3d5601 100644
--- a/services/backup/java/com/android/server/backup/utils/FullBackupUtils.java
+++ b/services/backup/java/com/android/server/backup/utils/FullBackupUtils.java
@@ -22,6 +22,7 @@
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
 import android.content.pm.Signature;
+import android.content.pm.SigningInfo;
 import android.os.Build;
 import android.os.ParcelFileDescriptor;
 import android.util.Slog;
@@ -106,12 +107,13 @@
         printer.println(withApk ? "1" : "0");
 
         // write the signature block
-        Signature[][] signingHistory = pkg.signingCertificateHistory;
-        if (signingHistory == null) {
+        SigningInfo signingInfo = pkg.signingInfo;
+        if (signingInfo == null) {
             printer.println("0");
         } else {
             // retrieve the newest sigs to write
-            Signature[] signatures = signingHistory[signingHistory.length - 1];
+            // TODO (b/73988180) use entire signing history in case of rollbacks
+            Signature[] signatures = signingInfo.getApkContentsSigners();
             printer.println(Integer.toString(signatures.length));
             for (Signature sig : signatures) {
                 printer.println(sig.toCharsString());
diff --git a/services/core/java/com/android/server/AlarmManagerService.java b/services/core/java/com/android/server/AlarmManagerService.java
index 8ce4e64..6f4ae15 100644
--- a/services/core/java/com/android/server/AlarmManagerService.java
+++ b/services/core/java/com/android/server/AlarmManagerService.java
@@ -88,6 +88,7 @@
 import com.android.internal.util.ArrayUtils;
 import com.android.internal.util.DumpUtils;
 import com.android.internal.util.LocalLog;
+import com.android.internal.util.StatLogger;
 import com.android.server.AppStateTracker.Listener;
 
 import java.io.ByteArrayOutputStream;
diff --git a/services/core/java/com/android/server/AppStateTracker.java b/services/core/java/com/android/server/AppStateTracker.java
index cec4f1a..23c5779 100644
--- a/services/core/java/com/android/server/AppStateTracker.java
+++ b/services/core/java/com/android/server/AppStateTracker.java
@@ -55,6 +55,7 @@
 import com.android.internal.util.ArrayUtils;
 import com.android.internal.util.IndentingPrintWriter;
 import com.android.internal.util.Preconditions;
+import com.android.internal.util.StatLogger;
 import com.android.server.ForceAppStandbyTrackerProto.ExemptedPackage;
 import com.android.server.ForceAppStandbyTrackerProto.RunAnyInBackgroundRestrictedPackages;
 
diff --git a/services/core/java/com/android/server/StatLogger.java b/services/core/java/com/android/server/StatLogger.java
deleted file mode 100644
index d85810d..0000000
--- a/services/core/java/com/android/server/StatLogger.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.server;
-
-import android.os.SystemClock;
-import android.util.Slog;
-import android.util.proto.ProtoOutputStream;
-
-import com.android.internal.annotations.GuardedBy;
-import com.android.internal.util.IndentingPrintWriter;
-import com.android.server.StatLoggerProto.Event;
-
-import java.io.PrintWriter;
-
-/**
- * Simple class to keep track of the number of times certain events happened and their durations for
- * benchmarking.
- *
- * TODO Update shortcut service to switch to it.
- *
- * @hide
- */
-public class StatLogger {
-    private static final String TAG = "StatLogger";
-
-    private final Object mLock = new Object();
-
-    private final int SIZE;
-
-    @GuardedBy("mLock")
-    private final int[] mCountStats;
-
-    @GuardedBy("mLock")
-    private final long[] mDurationStats;
-
-    private final String[] mLabels;
-
-    public StatLogger(String[] eventLabels) {
-        SIZE = eventLabels.length;
-        mCountStats = new int[SIZE];
-        mDurationStats = new long[SIZE];
-        mLabels = eventLabels;
-    }
-
-    /**
-     * Return the current time in the internal time unit.
-     * Call it before an event happens, and
-     * give it back to the {@link #logDurationStat(int, long)}} after the event.
-     */
-    public long getTime() {
-        return SystemClock.elapsedRealtimeNanos() / 1000;
-    }
-
-    /**
-     * @see {@link #getTime()}
-     */
-    public void logDurationStat(int eventId, long start) {
-        synchronized (mLock) {
-            if (eventId >= 0 && eventId < SIZE) {
-                mCountStats[eventId]++;
-                mDurationStats[eventId] += (getTime() - start);
-            } else {
-                Slog.wtf(TAG, "Invalid event ID: " + eventId);
-            }
-        }
-    }
-
-    @Deprecated
-    public void dump(PrintWriter pw, String prefix) {
-        dump(new IndentingPrintWriter(pw, "  ").setIndent(prefix));
-    }
-
-    public void dump(IndentingPrintWriter pw) {
-        synchronized (mLock) {
-            pw.println("Stats:");
-            pw.increaseIndent();
-            for (int i = 0; i < SIZE; i++) {
-                final int count = mCountStats[i];
-                final double durationMs = mDurationStats[i] / 1000.0;
-                pw.println(String.format("%s: count=%d, total=%.1fms, avg=%.3fms",
-                        mLabels[i], count, durationMs,
-                        (count == 0 ? 0 : ((double) durationMs) / count)));
-            }
-            pw.decreaseIndent();
-        }
-    }
-
-    public void dumpProto(ProtoOutputStream proto, long fieldId) {
-        synchronized (mLock) {
-            final long outer = proto.start(fieldId);
-
-            for (int i = 0; i < mLabels.length; i++) {
-                final long inner = proto.start(StatLoggerProto.EVENTS);
-
-                proto.write(Event.EVENT_ID, i);
-                proto.write(Event.LABEL, mLabels[i]);
-                proto.write(Event.COUNT, mCountStats[i]);
-                proto.write(Event.TOTAL_DURATION_MICROS, mDurationStats[i]);
-
-                proto.end(inner);
-            }
-
-            proto.end(outer);
-        }
-    }
-}
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 256be3e..47284cb 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -7698,7 +7698,7 @@
             // target APIs higher than O MR1. Since access to the serial
             // is now behind a permission we push down the value.
             final String buildSerial = (appInfo.targetSandboxVersion < 2
-                    && appInfo.targetSdkVersion <= Build.VERSION_CODES.O_MR1)
+                    && appInfo.targetSdkVersion < Build.VERSION_CODES.P)
                             ? sTheRealBuildSerial : Build.UNKNOWN;
 
             // Check if this is a secondary process that should be incorporated into some
@@ -17056,6 +17056,11 @@
                     pw.println("ms");
                 }
                 mUidObservers.finishBroadcast();
+
+                pw.println();
+                pw.println("  ServiceManager statistics:");
+                ServiceManager.sStatLogger.dump(pw, "    ");
+                pw.println();
             }
         }
         pw.println("  mForceBackgroundCheck=" + mForceBackgroundCheck);
@@ -26681,7 +26686,7 @@
                 record.waitingForNetwork = false;
                 final long totalTime = SystemClock.uptimeMillis() - startTime;
                 if (totalTime >= mWaitForNetworkTimeoutMs || DEBUG_NETWORK) {
-                    Slog.wtf(TAG_NETWORK, "Total time waited for network rules to get updated: "
+                    Slog.w(TAG_NETWORK, "Total time waited for network rules to get updated: "
                             + totalTime + ". Uid: " + callingUid + " procStateSeq: "
                             + procStateSeq + " UidRec: " + record
                             + " validateUidRec: " + mValidateUids.get(callingUid));
diff --git a/services/core/java/com/android/server/am/ActivityStartInterceptor.java b/services/core/java/com/android/server/am/ActivityStartInterceptor.java
index 6ca8a92..5b6b508 100644
--- a/services/core/java/com/android/server/am/ActivityStartInterceptor.java
+++ b/services/core/java/com/android/server/am/ActivityStartInterceptor.java
@@ -234,8 +234,9 @@
     private Intent createSuspendedAppInterceptIntent(String suspendedPackage,
             String suspendingPackage, String dialogMessage, int userId) {
         final Intent interceptIntent = new Intent(mServiceContext, SuspendedAppActivity.class)
-                .putExtra(Intent.EXTRA_PACKAGE_NAME, suspendedPackage)
+                .putExtra(SuspendedAppActivity.EXTRA_SUSPENDED_PACKAGE, suspendedPackage)
                 .putExtra(SuspendedAppActivity.EXTRA_DIALOG_MESSAGE, dialogMessage)
+                .putExtra(SuspendedAppActivity.EXTRA_SUSPENDING_PACKAGE, suspendingPackage)
                 .putExtra(Intent.EXTRA_USER_ID, userId)
                 .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                         | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
diff --git a/services/core/java/com/android/server/backup/BackupUtils.java b/services/core/java/com/android/server/backup/BackupUtils.java
index d817534..96c5621 100644
--- a/services/core/java/com/android/server/backup/BackupUtils.java
+++ b/services/core/java/com/android/server/backup/BackupUtils.java
@@ -20,6 +20,7 @@
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManagerInternal;
 import android.content.pm.Signature;
+import android.content.pm.SigningInfo;
 import android.util.Slog;
 
 import com.android.internal.util.ArrayUtils;
@@ -55,16 +56,16 @@
             return false;
         }
 
-        Signature[][] deviceHistorySigs = target.signingCertificateHistory;
-        if (ArrayUtils.isEmpty(deviceHistorySigs)) {
-            Slog.w(TAG, "signingCertificateHistory is empty, app was either unsigned or the flag" +
+        SigningInfo signingInfo = target.signingInfo;
+        if (signingInfo == null) {
+            Slog.w(TAG, "signingInfo is empty, app was either unsigned or the flag" +
                     " PackageManager#GET_SIGNING_CERTIFICATES was not specified");
             return false;
         }
 
         if (DEBUG) {
             Slog.v(TAG, "signaturesMatch(): stored=" + storedSigHashes
-                    + " device=" + deviceHistorySigs);
+                    + " device=" + signingInfo.getApkContentsSigners());
         }
 
         final int nStored = storedSigHashes.size();
@@ -78,8 +79,9 @@
         } else {
             // the app couldn't have rotated keys, since it was signed with multiple sigs - do
             // a check to see if we find a match for all stored sigs
-            // since app hasn't rotated key, we only need to check with deviceHistorySigs[0]
-            ArrayList<byte[]> deviceHashes = hashSignatureArray(deviceHistorySigs[0]);
+            // since app hasn't rotated key, we only need to check with current signers
+            ArrayList<byte[]> deviceHashes =
+                    hashSignatureArray(signingInfo.getApkContentsSigners());
             int nDevice = deviceHashes.size();
             // ensure that each stored sig matches an on-device sig
             for (int i = 0; i < nStored; i++) {
diff --git a/services/core/java/com/android/server/fingerprint/FingerprintService.java b/services/core/java/com/android/server/fingerprint/FingerprintService.java
index 4e95bdf..4a1beb1 100644
--- a/services/core/java/com/android/server/fingerprint/FingerprintService.java
+++ b/services/core/java/com/android/server/fingerprint/FingerprintService.java
@@ -230,10 +230,11 @@
                 }
                 List<ActivityManager.RunningTaskInfo> runningTasks = mActivityManager.getTasks(1);
                 if (!runningTasks.isEmpty()) {
-                    if (runningTasks.get(0).topActivity.getPackageName()
-                            != mCurrentClient.getOwnerString()) {
+                    final String topPackage = runningTasks.get(0).topActivity.getPackageName();
+                    if (!topPackage.contentEquals(mCurrentClient.getOwnerString())) {
                         mCurrentClient.stop(false /* initiatedByClient */);
-                        Slog.e(TAG, "Stopping background authentication");
+                        Slog.e(TAG, "Stopping background authentication, top: " + topPackage
+                                + " currentClient: " + mCurrentClient.getOwnerString());
                     }
                 }
             } catch (RemoteException e) {
diff --git a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
index 8e77373..a85960a 100644
--- a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
+++ b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
@@ -80,6 +80,9 @@
 import static android.telephony.CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED;
 import static android.telephony.CarrierConfigManager.DATA_CYCLE_THRESHOLD_DISABLED;
 import static android.telephony.CarrierConfigManager.DATA_CYCLE_USE_PLATFORM_DEFAULT;
+import static android.telephony.CarrierConfigManager.KEY_DATA_LIMIT_NOTIFICATION_BOOL;
+import static android.telephony.CarrierConfigManager.KEY_DATA_RAPID_NOTIFICATION_BOOL;
+import static android.telephony.CarrierConfigManager.KEY_DATA_WARNING_NOTIFICATION_BOOL;
 import static android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID;
 
 import static com.android.internal.util.ArrayUtils.appendInt;
@@ -217,6 +220,7 @@
 import com.android.internal.util.FastXmlSerializer;
 import com.android.internal.util.IndentingPrintWriter;
 import com.android.internal.util.Preconditions;
+import com.android.internal.util.StatLogger;
 import com.android.server.EventLogTags;
 import com.android.server.LocalServices;
 import com.android.server.ServiceThread;
@@ -545,6 +549,19 @@
 
     // TODO: migrate notifications to SystemUI
 
+
+    interface Stats {
+        int UPDATE_NETWORK_ENABLED = 0;
+        int IS_UID_NETWORKING_BLOCKED = 1;
+
+        int COUNT = IS_UID_NETWORKING_BLOCKED + 1;
+    }
+
+    public final StatLogger mStatLogger = new StatLogger(new String[] {
+            "updateNetworkEnabledNL()",
+            "isUidNetworkingBlocked()",
+    });
+
     public NetworkPolicyManagerService(Context context, IActivityManager activityManager,
             INetworkManagementService networkManagement) {
         this(context, activityManager, networkManagement, AppGlobals.getPackageManager(),
@@ -1093,8 +1110,10 @@
         final long now = mClock.millis();
         for (int i = mNetworkPolicy.size()-1; i >= 0; i--) {
             final NetworkPolicy policy = mNetworkPolicy.valueAt(i);
+            final int subId = findRelevantSubId(policy.template);
+
             // ignore policies that aren't relevant to user
-            if (!isTemplateRelevant(policy.template)) continue;
+            if (subId == INVALID_SUBSCRIPTION_ID) continue;
             if (!policy.hasCycle()) continue;
 
             final Pair<ZonedDateTime, ZonedDateTime> cycle = NetworkPolicyManager
@@ -1103,28 +1122,43 @@
             final long cycleEnd = cycle.second.toInstant().toEpochMilli();
             final long totalBytes = getTotalBytes(policy.template, cycleStart, cycleEnd);
 
-            // Notify when data usage is over warning/limit
-            if (policy.isOverLimit(totalBytes)) {
-                final boolean snoozedThisCycle = policy.lastLimitSnooze >= cycleStart;
-                if (snoozedThisCycle) {
-                    enqueueNotification(policy, TYPE_LIMIT_SNOOZED, totalBytes, null);
-                } else {
-                    enqueueNotification(policy, TYPE_LIMIT, totalBytes, null);
-                    notifyOverLimitNL(policy.template);
+            // Carrier might want to manage notifications themselves
+            final PersistableBundle config = mCarrierConfigManager.getConfigForSubId(subId);
+            final boolean notifyWarning = getBooleanDefeatingNullable(config,
+                    KEY_DATA_WARNING_NOTIFICATION_BOOL, true);
+            final boolean notifyLimit = getBooleanDefeatingNullable(config,
+                    KEY_DATA_LIMIT_NOTIFICATION_BOOL, true);
+            final boolean notifyRapid = getBooleanDefeatingNullable(config,
+                    KEY_DATA_RAPID_NOTIFICATION_BOOL, true);
+
+            // Notify when data usage is over warning
+            if (notifyWarning) {
+                if (policy.isOverWarning(totalBytes) && !policy.isOverLimit(totalBytes)) {
+                    final boolean snoozedThisCycle = policy.lastWarningSnooze >= cycleStart;
+                    if (!snoozedThisCycle) {
+                        enqueueNotification(policy, TYPE_WARNING, totalBytes, null);
+                    }
                 }
+            }
 
-            } else {
-                notifyUnderLimitNL(policy.template);
-
-                final boolean snoozedThisCycle = policy.lastWarningSnooze >= cycleStart;
-                if (policy.isOverWarning(totalBytes) && !snoozedThisCycle) {
-                    enqueueNotification(policy, TYPE_WARNING, totalBytes, null);
+            // Notify when data usage is over limit
+            if (notifyLimit) {
+                if (policy.isOverLimit(totalBytes)) {
+                    final boolean snoozedThisCycle = policy.lastLimitSnooze >= cycleStart;
+                    if (snoozedThisCycle) {
+                        enqueueNotification(policy, TYPE_LIMIT_SNOOZED, totalBytes, null);
+                    } else {
+                        enqueueNotification(policy, TYPE_LIMIT, totalBytes, null);
+                        notifyOverLimitNL(policy.template);
+                    }
+                } else {
+                    notifyUnderLimitNL(policy.template);
                 }
             }
 
             // Warn if average usage over last 4 days is on track to blow pretty
             // far past the plan limits.
-            if (policy.limitBytes != LIMIT_DISABLED) {
+            if (notifyRapid && policy.limitBytes != LIMIT_DISABLED) {
                 final long recentDuration = TimeUnit.DAYS.toMillis(4);
                 final long recentStart = now - recentDuration;
                 final long recentEnd = now;
@@ -1201,27 +1235,26 @@
      * current device state, such as when
      * {@link TelephonyManager#getSubscriberId()} matches. This is regardless of
      * data connection status.
+     *
+     * @return relevant subId, or {@link #INVALID_SUBSCRIPTION_ID} when no
+     *         matching subId found.
      */
-    private boolean isTemplateRelevant(NetworkTemplate template) {
-        if (template.isMatchRuleMobile()) {
-            final TelephonyManager tele = mContext.getSystemService(TelephonyManager.class);
-            final SubscriptionManager sub = mContext.getSystemService(SubscriptionManager.class);
+    private int findRelevantSubId(NetworkTemplate template) {
+        final TelephonyManager tele = mContext.getSystemService(TelephonyManager.class);
+        final SubscriptionManager sub = mContext.getSystemService(SubscriptionManager.class);
 
-            // Mobile template is relevant when any active subscriber matches
-            final int[] subIds = ArrayUtils.defeatNullable(sub.getActiveSubscriptionIdList());
-            for (int subId : subIds) {
-                final String subscriberId = tele.getSubscriberId(subId);
-                final NetworkIdentity probeIdent = new NetworkIdentity(TYPE_MOBILE,
-                        TelephonyManager.NETWORK_TYPE_UNKNOWN, subscriberId, null, false, true,
-                        true);
-                if (template.matches(probeIdent)) {
-                    return true;
-                }
+        // Mobile template is relevant when any active subscriber matches
+        final int[] subIds = ArrayUtils.defeatNullable(sub.getActiveSubscriptionIdList());
+        for (int subId : subIds) {
+            final String subscriberId = tele.getSubscriberId(subId);
+            final NetworkIdentity probeIdent = new NetworkIdentity(TYPE_MOBILE,
+                    TelephonyManager.NETWORK_TYPE_UNKNOWN, subscriberId, null, false, true,
+                    true);
+            if (template.matches(probeIdent)) {
+                return subId;
             }
-            return false;
-        } else {
-            return true;
         }
+        return INVALID_SUBSCRIPTION_ID;
     }
 
     /**
@@ -1572,6 +1605,8 @@
         // TODO: reset any policy-disabled networks when any policy is removed
         // completely, which is currently rare case.
 
+        final long startTime = mStatLogger.getTime();
+
         for (int i = mNetworkPolicy.size()-1; i >= 0; i--) {
             final NetworkPolicy policy = mNetworkPolicy.valueAt(i);
             // shortcut when policy has no limit
@@ -1593,6 +1628,8 @@
 
             setNetworkTemplateEnabled(policy.template, networkEnabled);
         }
+
+        mStatLogger.logDurationStat(Stats.UPDATE_NETWORK_ENABLED, startTime);
     }
 
     /**
@@ -3086,9 +3123,11 @@
 
         // We can only override when carrier told us about plans
         synchronized (mNetworkPoliciesSecondLock) {
-            if (ArrayUtils.isEmpty(mSubscriptionPlans.get(subId))) {
+            final SubscriptionPlan plan = getPrimarySubscriptionPlanLocked(subId);
+            if (plan == null
+                    || plan.getDataLimitBehavior() == SubscriptionPlan.LIMIT_BEHAVIOR_UNKNOWN) {
                 throw new IllegalStateException(
-                        "Must provide SubscriptionPlan information before overriding");
+                        "Must provide valid SubscriptionPlan to enable overriding");
             }
         }
 
@@ -3280,6 +3319,9 @@
                 }
                 fout.decreaseIndent();
 
+                fout.println();
+                mStatLogger.dump(fout);
+
                 mLogger.dumpLogs(fout);
             }
         }
@@ -4639,8 +4681,14 @@
 
     @Override
     public boolean isUidNetworkingBlocked(int uid, boolean isNetworkMetered) {
+        final long startTime = mStatLogger.getTime();
+
         mContext.enforceCallingOrSelfPermission(MANAGE_NETWORK_POLICY, TAG);
-        return isUidNetworkingBlockedInternal(uid, isNetworkMetered);
+        final boolean ret = isUidNetworkingBlockedInternal(uid, isNetworkMetered);
+
+        mStatLogger.logDurationStat(Stats.IS_UID_NETWORKING_BLOCKED, startTime);
+
+        return ret;
     }
 
     private boolean isUidNetworkingBlockedInternal(int uid, boolean isNetworkMetered) {
@@ -4715,11 +4763,17 @@
          */
         @Override
         public boolean isUidNetworkingBlocked(int uid, String ifname) {
+            final long startTime = mStatLogger.getTime();
+
             final boolean isNetworkMetered;
             synchronized (mNetworkPoliciesSecondLock) {
                 isNetworkMetered = mMeteredIfaces.contains(ifname);
             }
-            return isUidNetworkingBlockedInternal(uid, isNetworkMetered);
+            final boolean ret = isUidNetworkingBlockedInternal(uid, isNetworkMetered);
+
+            mStatLogger.logDurationStat(Stats.IS_UID_NETWORKING_BLOCKED, startTime);
+
+            return ret;
         }
 
         @Override
@@ -4831,7 +4885,21 @@
     @GuardedBy("mNetworkPoliciesSecondLock")
     private SubscriptionPlan getPrimarySubscriptionPlanLocked(int subId) {
         final SubscriptionPlan[] plans = mSubscriptionPlans.get(subId);
-        return ArrayUtils.isEmpty(plans) ? null : plans[0];
+        if (!ArrayUtils.isEmpty(plans)) {
+            for (SubscriptionPlan plan : plans) {
+                if (plan.getCycleRule().isRecurring()) {
+                    // Recurring plans will always have an active cycle
+                    return plan;
+                } else {
+                    // Non-recurring plans need manual test for active cycle
+                    final Range<ZonedDateTime> cycle = plan.cycleIterator().next();
+                    if (cycle.contains(ZonedDateTime.now(mClock))) {
+                        return plan;
+                    }
+                }
+            }
+        }
+        return null;
     }
 
     /**
@@ -4878,6 +4946,11 @@
         return (val != null) ? val : new NetworkState[0];
     }
 
+    private static boolean getBooleanDefeatingNullable(@Nullable PersistableBundle bundle,
+            String key, boolean defaultValue) {
+        return (bundle != null) ? bundle.getBoolean(key, defaultValue) : defaultValue;
+    }
+
     private class NotificationId {
         private final String mTag;
         private final int mId;
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index 3ecf6b5..2c0f469 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -1872,7 +1872,7 @@
         };
 
         int newSuppressedVisualEffects = incomingPolicy.suppressedVisualEffects;
-        if (targetSdkVersion <= Build.VERSION_CODES.O_MR1) {
+        if (targetSdkVersion < Build.VERSION_CODES.P) {
             // unset higher order bits introduced in P, maintain the user's higher order bits
             for (int i = 0; i < effectsIntroducedInP.length ; i++) {
                 newSuppressedVisualEffects &= ~effectsIntroducedInP[i];
@@ -3249,7 +3249,7 @@
                         0, UserHandle.getUserId(MY_UID));
                 Policy currPolicy = mZenModeHelper.getNotificationPolicy();
 
-                if (applicationInfo.targetSdkVersion <= Build.VERSION_CODES.O_MR1) {
+                if (applicationInfo.targetSdkVersion < Build.VERSION_CODES.P) {
                     int priorityCategories = policy.priorityCategories;
                     // ignore alarm and media values from new policy
                     priorityCategories &= ~Policy.PRIORITY_CATEGORY_ALARMS;
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 2265450..a047604 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -9707,7 +9707,7 @@
                     if (expectedCertDigests.length > 1) {
 
                         // For apps targeting O MR1 we require explicit enumeration of all certs.
-                        final String[] libCertDigests = (targetSdk > Build.VERSION_CODES.O)
+                        final String[] libCertDigests = (targetSdk >= Build.VERSION_CODES.O_MR1)
                                 ? PackageUtils.computeSignaturesSha256Digests(
                                 libPkg.mSigningDetails.signatures)
                                 : PackageUtils.computeSignaturesSha256Digests(
diff --git a/services/core/java/com/android/server/pm/ShortcutPackageInfo.java b/services/core/java/com/android/server/pm/ShortcutPackageInfo.java
index eeaa333..8c7871f 100644
--- a/services/core/java/com/android/server/pm/ShortcutPackageInfo.java
+++ b/services/core/java/com/android/server/pm/ShortcutPackageInfo.java
@@ -21,6 +21,7 @@
 import android.content.pm.PackageManagerInternal;
 import android.content.pm.ShortcutInfo;
 import android.content.pm.Signature;
+import android.content.pm.SigningInfo;
 import android.util.Slog;
 
 import com.android.internal.annotations.VisibleForTesting;
@@ -164,12 +165,13 @@
             ShortcutService s, String packageName, @UserIdInt int packageUserId) {
         final PackageInfo pi = s.getPackageInfoWithSignatures(packageName, packageUserId);
         // retrieve the newest sigs
-        Signature[][] signingHistory = pi.signingCertificateHistory;
-        if (signingHistory == null || signingHistory.length == 0) {
+        SigningInfo signingInfo = pi.signingInfo;
+        if (signingInfo == null) {
             Slog.e(TAG, "Can't get signatures: package=" + packageName);
             return null;
         }
-        Signature[] signatures = signingHistory[signingHistory.length - 1];
+        // TODO (b/73988180) use entire signing history in case of rollbacks
+        Signature[] signatures = signingInfo.getApkContentsSigners();
         final ShortcutPackageInfo ret = new ShortcutPackageInfo(pi.getLongVersionCode(),
                 pi.lastUpdateTime, BackupUtils.hashSignatureArray(signatures), /* shadow=*/ false);
 
@@ -192,13 +194,14 @@
             return;
         }
         // retrieve the newest sigs
-        Signature[][] signingHistory = pi.signingCertificateHistory;
-        if (signingHistory == null || signingHistory.length == 0) {
+        SigningInfo signingInfo = pi.signingInfo;
+        if (signingInfo == null) {
             Slog.w(TAG, "Not refreshing signature for " + pkg.getPackageName()
-                    + " since it appears to have no signature history.");
+                    + " since it appears to have no signing info.");
             return;
         }
-        Signature[] signatures = signingHistory[signingHistory.length - 1];
+        // TODO (b/73988180) use entire signing history in case of rollbacks
+        Signature[] signatures = signingInfo.getApkContentsSigners();
         mSigHashes = BackupUtils.hashSignatureArray(signatures);
     }
 
diff --git a/services/core/java/com/android/server/pm/ShortcutService.java b/services/core/java/com/android/server/pm/ShortcutService.java
index 15b4617..599e5a5 100644
--- a/services/core/java/com/android/server/pm/ShortcutService.java
+++ b/services/core/java/com/android/server/pm/ShortcutService.java
@@ -48,7 +48,6 @@
 import android.content.pm.ShortcutInfo;
 import android.content.pm.ShortcutServiceInternal;
 import android.content.pm.ShortcutServiceInternal.ShortcutChangeListener;
-import android.content.pm.UserInfo;
 import android.content.res.Resources;
 import android.content.res.XmlResourceParser;
 import android.graphics.Bitmap;
@@ -100,7 +99,7 @@
 import com.android.internal.util.FastXmlSerializer;
 import com.android.internal.util.Preconditions;
 import com.android.server.LocalServices;
-import com.android.server.StatLogger;
+import com.android.internal.util.StatLogger;
 import com.android.server.SystemService;
 import com.android.server.pm.ShortcutUser.PackageWithUser;
 
diff --git a/services/core/java/com/android/server/wm/Dimmer.java b/services/core/java/com/android/server/wm/Dimmer.java
index 1f95868..b8431b1 100644
--- a/services/core/java/com/android/server/wm/Dimmer.java
+++ b/services/core/java/com/android/server/wm/Dimmer.java
@@ -16,7 +16,7 @@
 
 package com.android.server.wm;
 
-import static com.android.server.wm.AlphaAnimationSpecProto.DURATION;
+import static com.android.server.wm.AlphaAnimationSpecProto.DURATION_MS;
 import static com.android.server.wm.AlphaAnimationSpecProto.FROM;
 import static com.android.server.wm.AlphaAnimationSpecProto.TO;
 import static com.android.server.wm.AnimationSpecProto.ALPHA;
@@ -35,6 +35,7 @@
  */
 class Dimmer {
     private static final String TAG = "WindowManager";
+    // This is in milliseconds.
     private static final int DEFAULT_DIM_ANIM_DURATION = 200;
 
     private class DimAnimatable implements SurfaceAnimator.Animatable {
@@ -370,7 +371,7 @@
             final long token = proto.start(ALPHA);
             proto.write(FROM, mFromAlpha);
             proto.write(TO, mToAlpha);
-            proto.write(DURATION, mDuration);
+            proto.write(DURATION_MS, mDuration);
             proto.end(token);
         }
     }
diff --git a/services/core/java/com/android/server/wm/Session.java b/services/core/java/com/android/server/wm/Session.java
index c808c91..4003d5a 100644
--- a/services/core/java/com/android/server/wm/Session.java
+++ b/services/core/java/com/android/server/wm/Session.java
@@ -45,7 +45,6 @@
 import android.util.Slog;
 import android.view.Display;
 import android.view.DisplayCutout;
-import android.view.DisplayCutout.ParcelableWrapper;
 import android.view.IWindow;
 import android.view.IWindowId;
 import android.view.IWindowSession;
@@ -195,7 +194,7 @@
             InputChannel outInputChannel) {
         return addToDisplay(window, seq, attrs, viewVisibility, Display.DEFAULT_DISPLAY,
                 new Rect() /* outFrame */, outContentInsets, outStableInsets, null /* outOutsets */,
-                null /* cutout */, outInputChannel);
+                new DisplayCutout.ParcelableWrapper()  /* cutout */, outInputChannel);
     }
 
     @Override
@@ -219,7 +218,7 @@
             int viewVisibility, int displayId, Rect outContentInsets, Rect outStableInsets) {
         return mService.addWindow(this, window, seq, attrs, viewVisibility, displayId,
                 new Rect() /* outFrame */, outContentInsets, outStableInsets, null /* outOutsets */,
-                new ParcelableWrapper() /* cutout */, null /* outInputChannel */);
+                new DisplayCutout.ParcelableWrapper() /* cutout */, null /* outInputChannel */);
     }
 
     @Override
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index da5bc73..aaf59b9 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -112,7 +112,7 @@
 import static com.android.server.wm.IdentifierProto.TITLE;
 import static com.android.server.wm.IdentifierProto.USER_ID;
 import static com.android.server.wm.AnimationSpecProto.MOVE;
-import static com.android.server.wm.MoveAnimationSpecProto.DURATION;
+import static com.android.server.wm.MoveAnimationSpecProto.DURATION_MS;
 import static com.android.server.wm.MoveAnimationSpecProto.FROM;
 import static com.android.server.wm.MoveAnimationSpecProto.TO;
 import static com.android.server.wm.WindowStateProto.ANIMATING_EXIT;
@@ -4106,11 +4106,10 @@
         mDestroying = true;
 
         final boolean hasSurface = mWinAnimator.hasSurface();
-        if (hasSurface) {
-            // Use pendingTransaction here so hide is done the same transaction as the other
-            // animations when exiting
-            mWinAnimator.hide(getPendingTransaction(), "onExitAnimationDone");
-        }
+
+        // Use pendingTransaction here so hide is done the same transaction as the other
+        // animations when exiting
+        mWinAnimator.hide(getPendingTransaction(), "onExitAnimationDone");
 
         // If we have an app token, we ask it to destroy the surface for us, so that it can take
         // care to ensure the activity has actually stopped and the surface is not still in use.
@@ -4826,7 +4825,7 @@
             final long token = proto.start(MOVE);
             mFrom.writeToProto(proto, FROM);
             mTo.writeToProto(proto, TO);
-            proto.write(DURATION, mDuration);
+            proto.write(DURATION_MS, mDuration);
             proto.end(token);
         }
     }
diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java
index ab5e24a..195274a 100644
--- a/services/core/java/com/android/server/wm/WindowStateAnimator.java
+++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java
@@ -308,6 +308,12 @@
         if (!mLastHidden) {
             //dump();
             mLastHidden = true;
+
+            // We may have a preserved surface which we no longer need. If there was a quick
+            // VISIBLE, GONE, VISIBLE, GONE sequence, the surface may never draw, so we don't mark
+            // it to be destroyed in prepareSurfaceLocked.
+            markPreservedSurfaceForDestroy();
+
             if (mSurfaceController != null) {
                 mSurfaceController.hide(transaction, reason);
             }
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index 82d2f3c..e07b89f 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -220,7 +220,7 @@
 import com.android.internal.widget.LockPatternUtils;
 import com.android.server.LocalServices;
 import com.android.server.LockGuard;
-import com.android.server.StatLogger;
+import com.android.internal.util.StatLogger;
 import com.android.server.SystemServerInitThreadPool;
 import com.android.server.SystemService;
 import com.android.server.devicepolicy.DevicePolicyManagerService.ActiveAdmin.TrustAgentInfo;
diff --git a/services/robotests/src/com/android/server/backup/PerformBackupTaskTest.java b/services/robotests/src/com/android/server/backup/PerformBackupTaskTest.java
index fa41220..949c504 100644
--- a/services/robotests/src/com/android/server/backup/PerformBackupTaskTest.java
+++ b/services/robotests/src/com/android/server/backup/PerformBackupTaskTest.java
@@ -492,9 +492,6 @@
         verify(agentMock.agent).onQuotaExceeded(anyLong(), anyLong());
     }
 
-    // TODO: Giving NPE at PerformBackupTask:524 because mCurrentPackage is null (PackageManager
-    // rightfully threw NameNotFoundException). Remove @Ignore when fixed.
-    @Ignore
     @Test
     public void testRunTask_whenAgentUnknown() throws Exception {
         // Not calling setUpAgent()
diff --git a/services/tests/servicestests/src/com/android/server/NetworkPolicyManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/NetworkPolicyManagerServiceTest.java
index cecc94b..b4dc941 100644
--- a/services/tests/servicestests/src/com/android/server/NetworkPolicyManagerServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/NetworkPolicyManagerServiceTest.java
@@ -1714,6 +1714,8 @@
     }
 
     private void expectNetworkState(boolean roaming) throws Exception {
+        when(mCarrierConfigManager.getConfigForSubId(eq(TEST_SUB_ID)))
+                .thenReturn(CarrierConfigManager.getDefaultConfig());
         when(mConnManager.getAllNetworkState()).thenReturn(new NetworkState[] {
                 new NetworkState(buildNetworkInfo(),
                         buildLinkProperties(TEST_IFACE),
diff --git a/services/tests/servicestests/src/com/android/server/backup/utils/AppBackupUtilsTest.java b/services/tests/servicestests/src/com/android/server/backup/utils/AppBackupUtilsTest.java
index d37db20..4f18be7 100644
--- a/services/tests/servicestests/src/com/android/server/backup/utils/AppBackupUtilsTest.java
+++ b/services/tests/servicestests/src/com/android/server/backup/utils/AppBackupUtilsTest.java
@@ -26,7 +26,9 @@
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
 import android.content.pm.PackageManagerInternal;
+import android.content.pm.PackageParser;
 import android.content.pm.Signature;
+import android.content.pm.SigningInfo;
 import android.os.Process;
 import android.platform.test.annotations.Presubmit;
 import android.support.test.filters.SmallTest;
@@ -395,7 +397,13 @@
             throws Exception {
         PackageInfo packageInfo = new PackageInfo();
         packageInfo.packageName = "test";
-        packageInfo.signingCertificateHistory = new Signature[][] {{SIGNATURE_1}};
+        packageInfo.signingInfo = new SigningInfo(
+                new PackageParser.SigningDetails(
+                        new Signature[] {SIGNATURE_1},
+                        PackageParser.SigningDetails.SignatureSchemeVersion.SIGNING_BLOCK_V3,
+                        null,
+                        null,
+                        null));
         packageInfo.applicationInfo = new ApplicationInfo();
 
         boolean result = AppBackupUtils.signaturesMatch(null, packageInfo,
@@ -409,7 +417,13 @@
             throws Exception {
         PackageInfo packageInfo = new PackageInfo();
         packageInfo.packageName = "test";
-        packageInfo.signingCertificateHistory = new Signature[][] {{SIGNATURE_1}};
+        packageInfo.signingInfo = new SigningInfo(
+                new PackageParser.SigningDetails(
+                        new Signature[] {SIGNATURE_1},
+                        PackageParser.SigningDetails.SignatureSchemeVersion.SIGNING_BLOCK_V3,
+                        null,
+                        null,
+                        null));
         packageInfo.applicationInfo = new ApplicationInfo();
 
         boolean result = AppBackupUtils.signaturesMatch(new Signature[0], packageInfo,
@@ -425,7 +439,7 @@
             throws Exception {
         PackageInfo packageInfo = new PackageInfo();
         packageInfo.packageName = "test";
-        packageInfo.signingCertificateHistory = new Signature[0][0];
+        packageInfo.signingInfo = null;
         packageInfo.applicationInfo = new ApplicationInfo();
 
         boolean result = AppBackupUtils.signaturesMatch(new Signature[] {SIGNATURE_1}, packageInfo,
@@ -440,7 +454,7 @@
             throws Exception {
         PackageInfo packageInfo = new PackageInfo();
         packageInfo.packageName = "test";
-        packageInfo.signingCertificateHistory = null;
+        packageInfo.signingInfo = null;
         packageInfo.applicationInfo = new ApplicationInfo();
 
         boolean result = AppBackupUtils.signaturesMatch(new Signature[] {SIGNATURE_1}, packageInfo,
@@ -453,7 +467,7 @@
     public void signaturesMatch_disallowsUnsignedApps_bothSignaturesNull_returnsFalse()
             throws Exception {
         PackageInfo packageInfo = new PackageInfo();
-        packageInfo.signingCertificateHistory = null;
+        packageInfo.signingInfo = null;
         packageInfo.applicationInfo = new ApplicationInfo();
 
         boolean result = AppBackupUtils.signaturesMatch(null, packageInfo,
@@ -467,7 +481,7 @@
             throws Exception {
         PackageInfo packageInfo = new PackageInfo();
         packageInfo.packageName = "test";
-        packageInfo.signingCertificateHistory = new Signature[0][0];
+        packageInfo.signingInfo = null;
         packageInfo.applicationInfo = new ApplicationInfo();
 
         boolean result = AppBackupUtils.signaturesMatch(new Signature[0], packageInfo,
@@ -484,9 +498,13 @@
 
         PackageInfo packageInfo = new PackageInfo();
         packageInfo.packageName = "test";
-        packageInfo.signingCertificateHistory = new Signature[][] {
-                {SIGNATURE_1, SIGNATURE_2, SIGNATURE_3}
-        };
+        packageInfo.signingInfo = new SigningInfo(
+                new PackageParser.SigningDetails(
+                        new Signature[] {SIGNATURE_1, SIGNATURE_2, SIGNATURE_3},
+                        PackageParser.SigningDetails.SignatureSchemeVersion.SIGNING_BLOCK_V3,
+                        null,
+                        null,
+                        null));
         packageInfo.applicationInfo = new ApplicationInfo();
 
         boolean result = AppBackupUtils.signaturesMatch(
@@ -503,9 +521,13 @@
 
         PackageInfo packageInfo = new PackageInfo();
         packageInfo.packageName = "test";
-        packageInfo.signingCertificateHistory = new Signature[][] {
-                {SIGNATURE_1, SIGNATURE_2, SIGNATURE_3}
-        };
+        packageInfo.signingInfo = new SigningInfo(
+                new PackageParser.SigningDetails(
+                        new Signature[] {SIGNATURE_1, SIGNATURE_2, SIGNATURE_3},
+                        PackageParser.SigningDetails.SignatureSchemeVersion.SIGNING_BLOCK_V3,
+                        null,
+                        null,
+                        null));
         packageInfo.applicationInfo = new ApplicationInfo();
 
         boolean result = AppBackupUtils.signaturesMatch(
@@ -522,9 +544,13 @@
 
         PackageInfo packageInfo = new PackageInfo();
         packageInfo.packageName = "test";
-        packageInfo.signingCertificateHistory = new Signature[][] {
-                {signature1Copy, signature2Copy}
-        };
+        packageInfo.signingInfo = new SigningInfo(
+                new PackageParser.SigningDetails(
+                        new Signature[] {signature1Copy, signature2Copy},
+                        PackageParser.SigningDetails.SignatureSchemeVersion.SIGNING_BLOCK_V3,
+                        null,
+                        null,
+                        null));
         packageInfo.applicationInfo = new ApplicationInfo();
 
         boolean result = AppBackupUtils.signaturesMatch(
@@ -541,9 +567,13 @@
 
         PackageInfo packageInfo = new PackageInfo();
         packageInfo.packageName = "test";
-        packageInfo.signingCertificateHistory = new Signature[][] {
-                {SIGNATURE_1, SIGNATURE_2, SIGNATURE_3}
-        };
+        packageInfo.signingInfo = new SigningInfo(
+                new PackageParser.SigningDetails(
+                        new Signature[] {SIGNATURE_1, SIGNATURE_2, SIGNATURE_3},
+                        PackageParser.SigningDetails.SignatureSchemeVersion.SIGNING_BLOCK_V3,
+                        null,
+                        null,
+                        null));
         packageInfo.applicationInfo = new ApplicationInfo();
 
         boolean result = AppBackupUtils.signaturesMatch(
@@ -560,7 +590,13 @@
 
         PackageInfo packageInfo = new PackageInfo();
         packageInfo.packageName = "test";
-        packageInfo.signingCertificateHistory = new Signature[][] {{SIGNATURE_1}};
+        packageInfo.signingInfo = new SigningInfo(
+                new PackageParser.SigningDetails(
+                        new Signature[] {SIGNATURE_1},
+                        PackageParser.SigningDetails.SignatureSchemeVersion.SIGNING_BLOCK_V3,
+                        null,
+                        null,
+                        null));
         packageInfo.applicationInfo = new ApplicationInfo();
 
         doReturn(true).when(mMockPackageManagerInternal).isDataRestoreSafe(signature1Copy,
@@ -579,7 +615,13 @@
 
         PackageInfo packageInfo = new PackageInfo();
         packageInfo.packageName = "test";
-        packageInfo.signingCertificateHistory = new Signature[][] {{SIGNATURE_1}, {SIGNATURE_2}};
+        packageInfo.signingInfo = new SigningInfo(
+                new PackageParser.SigningDetails(
+                        new Signature[] {SIGNATURE_2},
+                        PackageParser.SigningDetails.SignatureSchemeVersion.SIGNING_BLOCK_V3,
+                        null,
+                        new Signature[] {SIGNATURE_1, SIGNATURE_2},
+                        new int[] {0, 0}));
         packageInfo.applicationInfo = new ApplicationInfo();
 
         // we know signature1Copy is in history, and we want to assume it has
@@ -601,7 +643,13 @@
 
         PackageInfo packageInfo = new PackageInfo();
         packageInfo.packageName = "test";
-        packageInfo.signingCertificateHistory = new Signature[][] {{SIGNATURE_1}, {SIGNATURE_2}};
+        packageInfo.signingInfo = new SigningInfo(
+                new PackageParser.SigningDetails(
+                        new Signature[] {SIGNATURE_2},
+                        PackageParser.SigningDetails.SignatureSchemeVersion.SIGNING_BLOCK_V3,
+                        null,
+                        new Signature[] {SIGNATURE_1, SIGNATURE_2},
+                        new int[] {0, 0}));
         packageInfo.applicationInfo = new ApplicationInfo();
 
         // we know signature1Copy is in history, but we want to assume it does not have
diff --git a/services/tests/servicestests/src/com/android/server/backup/utils/TarBackupReaderTest.java b/services/tests/servicestests/src/com/android/server/backup/utils/TarBackupReaderTest.java
index 5f052ce..2830a74 100644
--- a/services/tests/servicestests/src/com/android/server/backup/utils/TarBackupReaderTest.java
+++ b/services/tests/servicestests/src/com/android/server/backup/utils/TarBackupReaderTest.java
@@ -41,7 +41,9 @@
 import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManagerInternal;
+import android.content.pm.PackageParser;
 import android.content.pm.Signature;
+import android.content.pm.SigningInfo;
 import android.os.Bundle;
 import android.os.Process;
 import android.platform.test.annotations.Presubmit;
@@ -371,7 +373,13 @@
         packageInfo.applicationInfo.flags |= ApplicationInfo.FLAG_ALLOW_BACKUP;
         packageInfo.applicationInfo.uid = Process.FIRST_APPLICATION_UID;
         packageInfo.applicationInfo.backupAgentName = null;
-        packageInfo.signingCertificateHistory = new Signature[][] {{FAKE_SIGNATURE_2}};
+        packageInfo.signingInfo = new SigningInfo(
+                new PackageParser.SigningDetails(
+                        new Signature[] {FAKE_SIGNATURE_2},
+                        PackageParser.SigningDetails.SignatureSchemeVersion.SIGNING_BLOCK_V3,
+                        null,
+                        null,
+                        null));
         PackageManagerStub.sPackageInfo = packageInfo;
 
         RestorePolicy policy = tarBackupReader.chooseRestorePolicy(mPackageManagerStub,
@@ -402,7 +410,13 @@
                 ApplicationInfo.FLAG_ALLOW_BACKUP | ApplicationInfo.FLAG_RESTORE_ANY_VERSION;
         packageInfo.applicationInfo.uid = Process.SYSTEM_UID;
         packageInfo.applicationInfo.backupAgentName = "backup.agent";
-        packageInfo.signingCertificateHistory = new Signature[][] {{FAKE_SIGNATURE_1}};
+        packageInfo.signingInfo = new SigningInfo(
+                new PackageParser.SigningDetails(
+                        new Signature[] {FAKE_SIGNATURE_1},
+                        PackageParser.SigningDetails.SignatureSchemeVersion.SIGNING_BLOCK_V3,
+                        null,
+                        null,
+                        null));
         PackageManagerStub.sPackageInfo = packageInfo;
 
         doReturn(true).when(mMockPackageManagerInternal).isDataRestoreSafe(FAKE_SIGNATURE_1,
@@ -434,7 +448,13 @@
                 ApplicationInfo.FLAG_ALLOW_BACKUP | ApplicationInfo.FLAG_RESTORE_ANY_VERSION;
         packageInfo.applicationInfo.uid = Process.FIRST_APPLICATION_UID;
         packageInfo.applicationInfo.backupAgentName = null;
-        packageInfo.signingCertificateHistory = new Signature[][] {{FAKE_SIGNATURE_1}};
+        packageInfo.signingInfo = new SigningInfo(
+                new PackageParser.SigningDetails(
+                        new Signature[] {FAKE_SIGNATURE_1},
+                        PackageParser.SigningDetails.SignatureSchemeVersion.SIGNING_BLOCK_V3,
+                        null,
+                        null,
+                        null));
         PackageManagerStub.sPackageInfo = packageInfo;
 
         doReturn(true).when(mMockPackageManagerInternal).isDataRestoreSafe(FAKE_SIGNATURE_1,
@@ -469,7 +489,13 @@
         packageInfo.applicationInfo.flags &= ~ApplicationInfo.FLAG_RESTORE_ANY_VERSION;
         packageInfo.applicationInfo.uid = Process.FIRST_APPLICATION_UID;
         packageInfo.applicationInfo.backupAgentName = null;
-        packageInfo.signingCertificateHistory = new Signature[][] {{FAKE_SIGNATURE_1}};
+        packageInfo.signingInfo = new SigningInfo(
+                new PackageParser.SigningDetails(
+                        new Signature[] {FAKE_SIGNATURE_1},
+                        PackageParser.SigningDetails.SignatureSchemeVersion.SIGNING_BLOCK_V3,
+                        null,
+                        null,
+                        null));
         packageInfo.versionCode = 2;
         PackageManagerStub.sPackageInfo = packageInfo;
 
@@ -507,7 +533,13 @@
         packageInfo.applicationInfo.flags &= ~ApplicationInfo.FLAG_RESTORE_ANY_VERSION;
         packageInfo.applicationInfo.uid = Process.FIRST_APPLICATION_UID;
         packageInfo.applicationInfo.backupAgentName = null;
-        packageInfo.signingCertificateHistory = new Signature[][] {{FAKE_SIGNATURE_1}};
+        packageInfo.signingInfo = new SigningInfo(
+                new PackageParser.SigningDetails(
+                        new Signature[] {FAKE_SIGNATURE_1},
+                        PackageParser.SigningDetails.SignatureSchemeVersion.SIGNING_BLOCK_V3,
+                        null,
+                        null,
+                        null));
         packageInfo.versionCode = 1;
         PackageManagerStub.sPackageInfo = packageInfo;
 
@@ -541,7 +573,13 @@
         packageInfo.applicationInfo.flags &= ~ApplicationInfo.FLAG_RESTORE_ANY_VERSION;
         packageInfo.applicationInfo.uid = Process.FIRST_APPLICATION_UID;
         packageInfo.applicationInfo.backupAgentName = null;
-        packageInfo.signingCertificateHistory = new Signature[][] {{FAKE_SIGNATURE_1}};
+        packageInfo.signingInfo = new SigningInfo(
+                new PackageParser.SigningDetails(
+                        new Signature[] {FAKE_SIGNATURE_1},
+                        PackageParser.SigningDetails.SignatureSchemeVersion.SIGNING_BLOCK_V3,
+                        null,
+                        null,
+                        null));
         packageInfo.versionCode = 1;
         PackageManagerStub.sPackageInfo = packageInfo;
 
diff --git a/services/tests/servicestests/src/com/android/server/pm/BaseShortcutManagerTest.java b/services/tests/servicestests/src/com/android/server/pm/BaseShortcutManagerTest.java
index ee83b62..998ffa0 100644
--- a/services/tests/servicestests/src/com/android/server/pm/BaseShortcutManagerTest.java
+++ b/services/tests/servicestests/src/com/android/server/pm/BaseShortcutManagerTest.java
@@ -58,11 +58,13 @@
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
 import android.content.pm.PackageManagerInternal;
+import android.content.pm.PackageParser;
 import android.content.pm.ResolveInfo;
 import android.content.pm.ShortcutInfo;
 import android.content.pm.ShortcutManager;
 import android.content.pm.ShortcutServiceInternal;
 import android.content.pm.Signature;
+import android.content.pm.SigningInfo;
 import android.content.pm.UserInfo;
 import android.content.res.Resources;
 import android.content.res.XmlResourceParser;
@@ -102,6 +104,8 @@
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.PrintWriter;
+import java.security.cert.CertificateEncodingException;
+import java.security.cert.CertificateException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -1039,8 +1043,13 @@
         pi.versionCode = version;
         pi.applicationInfo.setVersionCode(version);
         pi.signatures = null;
-        pi.signingCertificateHistory = new Signature[][] {genSignatures(signatures)};
-
+        pi.signingInfo = new SigningInfo(
+                new PackageParser.SigningDetails(
+                        genSignatures(signatures),
+                        PackageParser.SigningDetails.SignatureSchemeVersion.SIGNING_BLOCK_V3,
+                        null,
+                        null,
+                        null));
         return pi;
     }
 
@@ -1128,7 +1137,7 @@
 
         if (getSignatures) {
             ret.signatures = null;
-            ret.signingCertificateHistory = pi.signingCertificateHistory;
+            ret.signingInfo = pi.signingInfo;
         }
 
         return ret;
diff --git a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest5.java b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest5.java
index cd7feea..203b2ca 100644
--- a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest5.java
+++ b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest5.java
@@ -76,13 +76,13 @@
                 mMyPackage, mMyUserId, /*signature*/ false);
         assertEquals(mMyPackage, pi.packageName);
         assertNull(pi.signatures);
-        assertNull(pi.signingCertificateHistory);
+        assertNull(pi.signingInfo);
 
         pi = mShortcutService.getPackageInfo(
                 mMyPackage, mMyUserId, /*signature*/ true);
         assertEquals(mMyPackage, pi.packageName);
         assertNull(pi.signatures);
-        assertNotNull(pi.signingCertificateHistory);
+        assertNotNull(pi.signingInfo);
 
         pi = mShortcutService.getPackageInfo(
                 "no.such.package", mMyUserId, /*signature*/ true);
diff --git a/services/tests/servicestests/src/com/android/server/pm/SuspendPackagesTest.java b/services/tests/servicestests/src/com/android/server/pm/SuspendPackagesTest.java
index c5cd0a3..b8922eb 100644
--- a/services/tests/servicestests/src/com/android/server/pm/SuspendPackagesTest.java
+++ b/services/tests/servicestests/src/com/android/server/pm/SuspendPackagesTest.java
@@ -32,6 +32,7 @@
 import android.content.pm.IPackageManager;
 import android.content.pm.LauncherApps;
 import android.content.pm.PackageManager;
+import android.content.res.Resources;
 import android.os.BaseBundle;
 import android.os.Bundle;
 import android.os.Handler;
@@ -68,6 +69,7 @@
 @LargeTest
 public class SuspendPackagesTest {
     private static final String TAG = SuspendPackagesTest.class.getSimpleName();
+    private static final String TEST_APP_LABEL = "Suspend Test App";
     private static final String TEST_APP_PACKAGE_NAME = SuspendTestReceiver.PACKAGE_NAME;
     private static final String[] PACKAGES_TO_SUSPEND = new String[]{TEST_APP_PACKAGE_NAME};
 
@@ -446,23 +448,24 @@
         turnScreenOn();
         mAppCommsReceiver.register(mReceiverHandler, ACTION_REPORT_MORE_DETAILS_ACTIVITY_STARTED,
                 ACTION_REPORT_TEST_ACTIVITY_STARTED);
-        final String testMessage = "This is a test message";
+        final String testMessage = "This is a test message to report suspension of %1$s";
         suspendTestPackage(null, null, testMessage);
         startTestAppActivity();
         assertNull("No broadcast was expected from app", mAppCommsReceiver.pollForIntent(2));
-        assertNotNull("Given dialog message not shown",
-                mUiDevice.wait(Until.findObject(By.text(testMessage)), 5000));
-        final String buttonText = "More details";
+        assertNotNull("Given dialog message not shown", mUiDevice.wait(
+                Until.findObject(By.text(String.format(testMessage, TEST_APP_LABEL))), 5000));
+        final String buttonText = mContext.getResources().getString(Resources.getSystem()
+                .getIdentifier("app_suspended_more_details", "string", "android"));
         final UiObject2 moreDetailsButton = mUiDevice.findObject(
                 By.clickable(true).text(buttonText));
-        assertNotNull("\"More Details\" button not shown", moreDetailsButton);
+        assertNotNull(buttonText + " button not shown", moreDetailsButton);
         moreDetailsButton.click();
         final Intent intentFromApp = mAppCommsReceiver.receiveIntentFromApp();
-        assertEquals("\"More Details\" activity start not reported",
+        assertEquals(buttonText + " activity start not reported",
                 ACTION_REPORT_MORE_DETAILS_ACTIVITY_STARTED, intentFromApp.getAction());
         final String receivedPackageName = intentFromApp.getStringExtra(
                 EXTRA_RECEIVED_PACKAGE_NAME);
-        assertEquals("Wrong package name received by \"More Details\" activity",
+        assertEquals("Wrong package name received by " + buttonText + " activity",
                 TEST_APP_PACKAGE_NAME, receivedPackageName);
     }
 
diff --git a/services/tests/servicestests/src/com/android/server/pm/backup/BackupUtilsTest.java b/services/tests/servicestests/src/com/android/server/pm/backup/BackupUtilsTest.java
index 1ac7cb8..caa1d02 100644
--- a/services/tests/servicestests/src/com/android/server/pm/backup/BackupUtilsTest.java
+++ b/services/tests/servicestests/src/com/android/server/pm/backup/BackupUtilsTest.java
@@ -27,8 +27,10 @@
 import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManagerInternal;
+import android.content.pm.PackageParser;
 import android.content.pm.PackageParser.Package;
 import android.content.pm.Signature;
+import android.content.pm.SigningInfo;
 import android.test.MoreAsserts;
 import android.platform.test.annotations.Presubmit;
 import android.support.test.filters.SmallTest;
@@ -94,7 +96,13 @@
             throws Exception {
         PackageInfo packageInfo = new PackageInfo();
         packageInfo.packageName = "test";
-        packageInfo.signingCertificateHistory = new Signature[][] {{SIGNATURE_1}};
+        packageInfo.signingInfo = new SigningInfo(
+                new PackageParser.SigningDetails(
+                        new Signature[] {SIGNATURE_1},
+                        PackageParser.SigningDetails.SignatureSchemeVersion.SIGNING_BLOCK_V3,
+                        null,
+                        null,
+                        null));
         packageInfo.applicationInfo = new ApplicationInfo();
 
         boolean result = BackupUtils.signaturesMatch(null, packageInfo,
@@ -108,7 +116,13 @@
             throws Exception {
         PackageInfo packageInfo = new PackageInfo();
         packageInfo.packageName = "test";
-        packageInfo.signingCertificateHistory = new Signature[][] {{SIGNATURE_1}};
+        packageInfo.signingInfo = new SigningInfo(
+                new PackageParser.SigningDetails(
+                        new Signature[] {SIGNATURE_1},
+                        PackageParser.SigningDetails.SignatureSchemeVersion.SIGNING_BLOCK_V3,
+                        null,
+                        null,
+                        null));
         packageInfo.applicationInfo = new ApplicationInfo();
 
         ArrayList<byte[]> storedSigHashes = new ArrayList<>();
@@ -125,7 +139,7 @@
             throws Exception {
         PackageInfo packageInfo = new PackageInfo();
         packageInfo.packageName = "test";
-        packageInfo.signingCertificateHistory = new Signature[0][0];
+        packageInfo.signingInfo = null;
         packageInfo.applicationInfo = new ApplicationInfo();
 
         ArrayList<byte[]> storedSigHashes = new ArrayList<>();
@@ -142,7 +156,7 @@
             throws Exception {
         PackageInfo packageInfo = new PackageInfo();
         packageInfo.packageName = "test";
-        packageInfo.signingCertificateHistory = null;
+        packageInfo.signingInfo = null;
         packageInfo.applicationInfo = new ApplicationInfo();
 
         ArrayList<byte[]> storedSigHashes = new ArrayList<>();
@@ -158,7 +172,7 @@
             throws Exception {
         PackageInfo packageInfo = new PackageInfo();
         packageInfo.packageName = "test";
-        packageInfo.signingCertificateHistory = null;
+        packageInfo.signingInfo = null;
         packageInfo.applicationInfo = new ApplicationInfo();
 
         boolean result = BackupUtils.signaturesMatch(null, packageInfo,
@@ -172,7 +186,7 @@
             throws Exception {
         PackageInfo packageInfo = new PackageInfo();
         packageInfo.packageName = "test";
-        packageInfo.signingCertificateHistory = new Signature[0][0];
+        packageInfo.signingInfo = null;
         packageInfo.applicationInfo = new ApplicationInfo();
 
         ArrayList<byte[]> storedSigHashes = new ArrayList<>();
@@ -186,9 +200,13 @@
     public void signaturesMatch_equalSignatures_returnsTrue() throws Exception {
         PackageInfo packageInfo = new PackageInfo();
         packageInfo.packageName = "test";
-        packageInfo.signingCertificateHistory = new Signature[][] {
-                {SIGNATURE_1, SIGNATURE_2, SIGNATURE_3}
-        };
+        packageInfo.signingInfo = new SigningInfo(
+                new PackageParser.SigningDetails(
+                        new Signature[] {SIGNATURE_1, SIGNATURE_2, SIGNATURE_3},
+                        PackageParser.SigningDetails.SignatureSchemeVersion.SIGNING_BLOCK_V3,
+                        null,
+                        null,
+                        null));
         packageInfo.applicationInfo = new ApplicationInfo();
 
         ArrayList<byte[]> storedSigHashes = new ArrayList<>();
@@ -205,9 +223,13 @@
     public void signaturesMatch_extraSignatureInTarget_returnsTrue() throws Exception {
         PackageInfo packageInfo = new PackageInfo();
         packageInfo.packageName = "test";
-        packageInfo.signingCertificateHistory = new Signature[][] {
-                {SIGNATURE_1, SIGNATURE_2, SIGNATURE_3}
-        };
+        packageInfo.signingInfo = new SigningInfo(
+                new PackageParser.SigningDetails(
+                        new Signature[] {SIGNATURE_1, SIGNATURE_2, SIGNATURE_3},
+                        PackageParser.SigningDetails.SignatureSchemeVersion.SIGNING_BLOCK_V3,
+                        null,
+                        null,
+                        null));
         packageInfo.applicationInfo = new ApplicationInfo();
 
         ArrayList<byte[]> storedSigHashes = new ArrayList<>();
@@ -223,7 +245,13 @@
     public void signaturesMatch_extraSignatureInStored_returnsFalse() throws Exception {
         PackageInfo packageInfo = new PackageInfo();
         packageInfo.packageName = "test";
-        packageInfo.signingCertificateHistory = new Signature[][] {{SIGNATURE_1, SIGNATURE_2}};
+        packageInfo.signingInfo = new SigningInfo(
+                new PackageParser.SigningDetails(
+                        new Signature[] {SIGNATURE_1, SIGNATURE_2},
+                        PackageParser.SigningDetails.SignatureSchemeVersion.SIGNING_BLOCK_V3,
+                        null,
+                        null,
+                        null));
         packageInfo.applicationInfo = new ApplicationInfo();
 
         ArrayList<byte[]> storedSigHashes = new ArrayList<>();
@@ -240,9 +268,13 @@
     public void signaturesMatch_oneNonMatchingSignature_returnsFalse() throws Exception {
         PackageInfo packageInfo = new PackageInfo();
         packageInfo.packageName = "test";
-        packageInfo.signingCertificateHistory = new Signature[][] {
-                {SIGNATURE_1, SIGNATURE_2, SIGNATURE_3}
-        };
+        packageInfo.signingInfo = new SigningInfo(
+                new PackageParser.SigningDetails(
+                        new Signature[] {SIGNATURE_1, SIGNATURE_2, SIGNATURE_3},
+                        PackageParser.SigningDetails.SignatureSchemeVersion.SIGNING_BLOCK_V3,
+                        null,
+                        null,
+                        null));
         packageInfo.applicationInfo = new ApplicationInfo();
 
         ArrayList<byte[]> storedSigHashes = new ArrayList<>();
@@ -260,7 +292,13 @@
             throws Exception {
         PackageInfo packageInfo = new PackageInfo();
         packageInfo.packageName = "test";
-        packageInfo.signingCertificateHistory = new Signature[][] {{SIGNATURE_1}};
+        packageInfo.signingInfo = new SigningInfo(
+                new PackageParser.SigningDetails(
+                        new Signature[] {SIGNATURE_1},
+                        PackageParser.SigningDetails.SignatureSchemeVersion.SIGNING_BLOCK_V3,
+                        null,
+                        null,
+                        null));
         packageInfo.applicationInfo = new ApplicationInfo();
 
         doReturn(true).when(mMockPackageManagerInternal).isDataRestoreSafe(SIGNATURE_HASH_1,
@@ -279,7 +317,13 @@
             throws Exception {
         PackageInfo packageInfo = new PackageInfo();
         packageInfo.packageName = "test";
-        packageInfo.signingCertificateHistory = new Signature[][] {{SIGNATURE_1}, {SIGNATURE_2}};
+        packageInfo.signingInfo = new SigningInfo(
+                new PackageParser.SigningDetails(
+                        new Signature[] {SIGNATURE_1, SIGNATURE_2},
+                        PackageParser.SigningDetails.SignatureSchemeVersion.SIGNING_BLOCK_V3,
+                        null,
+                        null,
+                        null));
         packageInfo.applicationInfo = new ApplicationInfo();
 
         // we know SIGNATURE_1 is in history, and we want to assume it has
@@ -301,7 +345,13 @@
             throws Exception {
         PackageInfo packageInfo = new PackageInfo();
         packageInfo.packageName = "test";
-        packageInfo.signingCertificateHistory = new Signature[][] {{SIGNATURE_1}, {SIGNATURE_2}};
+        packageInfo.signingInfo = new SigningInfo(
+                new PackageParser.SigningDetails(
+                        new Signature[] {SIGNATURE_1, SIGNATURE_2},
+                        PackageParser.SigningDetails.SignatureSchemeVersion.SIGNING_BLOCK_V3,
+                        null,
+                        null,
+                        null));
         packageInfo.applicationInfo = new ApplicationInfo();
 
         // we know SIGNATURE_1 is in history, but we want to assume it does not have
diff --git a/services/tests/servicestests/test-apps/SuspendTestApp/AndroidManifest.xml b/services/tests/servicestests/test-apps/SuspendTestApp/AndroidManifest.xml
index ce6a27a..61058e6 100644
--- a/services/tests/servicestests/test-apps/SuspendTestApp/AndroidManifest.xml
+++ b/services/tests/servicestests/test-apps/SuspendTestApp/AndroidManifest.xml
@@ -17,7 +17,7 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
         package="com.android.servicestests.apps.suspendtestapp">
 
-    <application>
+    <application android:label="Suspend Test App">
         <activity android:name=".SuspendTestActivity"
                   android:exported="true" />
         <receiver android:name=".SuspendTestReceiver"
diff --git a/services/usb/java/com/android/server/usb/UsbDebuggingManager.java b/services/usb/java/com/android/server/usb/UsbDebuggingManager.java
index 74d8e12..3b08505 100644
--- a/services/usb/java/com/android/server/usb/UsbDebuggingManager.java
+++ b/services/usb/java/com/android/server/usb/UsbDebuggingManager.java
@@ -461,7 +461,7 @@
         long token = dump.start(idName, id);
 
         dump.write("connected_to_adb", UsbDebuggingManagerProto.CONNECTED_TO_ADB, mThread != null);
-        writeStringIfNotNull(dump, "last_key_received", UsbDebuggingManagerProto.LAST_KEY_RECEVIED,
+        writeStringIfNotNull(dump, "last_key_received", UsbDebuggingManagerProto.LAST_KEY_RECEIVED,
                 mFingerprints);
 
         try {
diff --git a/services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerService.java b/services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerService.java
index 1160943..cd524a5 100644
--- a/services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerService.java
+++ b/services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerService.java
@@ -926,25 +926,24 @@
                             Slog.w(TAG, mPuuid + ": Dropped operation as too many operations were "
                                     + "run in last 24 hours");
                         }
-                        return;
-                    }
+                    } else {
+                        mNumOps.addOp(currentTime);
 
-                    mNumOps.addOp(currentTime);
+                        // Find a free opID
+                        int opId = mNumTotalOpsPerformed;
+                        do {
+                            mNumTotalOpsPerformed++;
+                        } while (mRunningOpIds.contains(opId));
 
-                    // Find a free opID
-                    int opId = mNumTotalOpsPerformed;
-                    do {
-                        mNumTotalOpsPerformed++;
-                    } while (mRunningOpIds.contains(opId));
+                        // Run OP
+                        try {
+                            if (DEBUG) Slog.v(TAG, mPuuid + ": runOp " + opId);
 
-                    // Run OP
-                    try {
-                        if (DEBUG) Slog.v(TAG, mPuuid + ": runOp " + opId);
-
-                        op.run(opId, mService);
-                        mRunningOpIds.add(opId);
-                    } catch (Exception e) {
-                        Slog.e(TAG, mPuuid + ": Could not run operation " + opId, e);
+                            op.run(opId, mService);
+                            mRunningOpIds.add(opId);
+                        } catch (Exception e) {
+                            Slog.e(TAG, mPuuid + ": Could not run operation " + opId, e);
+                        }
                     }
 
                     // Unbind from service if no operations are left (i.e. if the operation failed)
diff --git a/telephony/java/android/telephony/AccessNetworkConstants.java b/telephony/java/android/telephony/AccessNetworkConstants.java
index cac9f2b..3b773b3 100644
--- a/telephony/java/android/telephony/AccessNetworkConstants.java
+++ b/telephony/java/android/telephony/AccessNetworkConstants.java
@@ -16,8 +16,6 @@
 
 package android.telephony;
 
-import android.annotation.SystemApi;
-
 /**
  * Contains access network related constants.
  */
@@ -39,7 +37,6 @@
      * Wireless transportation type
      * @hide
      */
-    @SystemApi
     public static final class TransportType {
         /** Wireless Wide Area Networks (i.e. Cellular) */
         public static final int WWAN = 1;
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index aa76eab..e244131 100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -1684,6 +1684,14 @@
             "data_warning_threshold_bytes_long";
 
     /**
+     * Controls if the device should automatically notify the user as they reach
+     * their cellular data warning. When set to {@code false} the carrier is
+     * expected to have implemented their own notification mechanism.
+     */
+    public static final String KEY_DATA_WARNING_NOTIFICATION_BOOL =
+            "data_warning_notification_bool";
+
+    /**
      * Controls the cellular data limit.
      * <p>
      * If the user uses more than this amount of data in their billing cycle, as defined by
@@ -1698,6 +1706,22 @@
             "data_limit_threshold_bytes_long";
 
     /**
+     * Controls if the device should automatically notify the user as they reach
+     * their cellular data limit. When set to {@code false} the carrier is
+     * expected to have implemented their own notification mechanism.
+     */
+    public static final String KEY_DATA_LIMIT_NOTIFICATION_BOOL =
+            "data_limit_notification_bool";
+
+    /**
+     * Controls if the device should automatically notify the user when rapid
+     * cellular data usage is observed. When set to {@code false} the carrier is
+     * expected to have implemented their own notification mechanism.
+     */
+    public static final String KEY_DATA_RAPID_NOTIFICATION_BOOL =
+            "data_rapid_notification_bool";
+
+    /**
      * Offset to be reduced from rsrp threshold while calculating signal strength level.
      * @hide
      */
@@ -2165,7 +2189,10 @@
 
         sDefaults.putInt(KEY_MONTHLY_DATA_CYCLE_DAY_INT, DATA_CYCLE_USE_PLATFORM_DEFAULT);
         sDefaults.putLong(KEY_DATA_WARNING_THRESHOLD_BYTES_LONG, DATA_CYCLE_USE_PLATFORM_DEFAULT);
+        sDefaults.putBoolean(KEY_DATA_WARNING_NOTIFICATION_BOOL, true);
         sDefaults.putLong(KEY_DATA_LIMIT_THRESHOLD_BYTES_LONG, DATA_CYCLE_USE_PLATFORM_DEFAULT);
+        sDefaults.putBoolean(KEY_DATA_LIMIT_NOTIFICATION_BOOL, true);
+        sDefaults.putBoolean(KEY_DATA_RAPID_NOTIFICATION_BOOL, true);
 
         // Rat families: {GPRS, EDGE}, {EVDO, EVDO_A, EVDO_B}, {UMTS, HSPA, HSDPA, HSUPA, HSPAP},
         // {LTE, LTE_CA}
diff --git a/telephony/java/android/telephony/NetworkRegistrationState.java b/telephony/java/android/telephony/NetworkRegistrationState.java
index bba779d..0e2e0ce 100644
--- a/telephony/java/android/telephony/NetworkRegistrationState.java
+++ b/telephony/java/android/telephony/NetworkRegistrationState.java
@@ -18,7 +18,6 @@
 
 import android.annotation.IntDef;
 import android.annotation.Nullable;
-import android.annotation.SystemApi;
 import android.os.Parcel;
 import android.os.Parcelable;
 
@@ -31,7 +30,6 @@
  * Description of a mobile network registration state
  * @hide
  */
-@SystemApi
 public class NetworkRegistrationState implements Parcelable {
     /**
      * Network domain
diff --git a/telephony/java/android/telephony/NetworkScan.java b/telephony/java/android/telephony/NetworkScan.java
index 073c313..7c7d7a0 100644
--- a/telephony/java/android/telephony/NetworkScan.java
+++ b/telephony/java/android/telephony/NetworkScan.java
@@ -120,7 +120,10 @@
         }
     }
 
-    /** @deprecated Use {@link #stopScan()} */
+    /**
+     * @deprecated Use {@link #stopScan()}
+     * @removed
+     */
     @Deprecated
     public void stop() throws RemoteException {
         try {
diff --git a/telephony/java/android/telephony/NetworkService.java b/telephony/java/android/telephony/NetworkService.java
index f7e6840..b431590 100644
--- a/telephony/java/android/telephony/NetworkService.java
+++ b/telephony/java/android/telephony/NetworkService.java
@@ -17,7 +17,6 @@
 package android.telephony;
 
 import android.annotation.CallSuper;
-import android.annotation.SystemApi;
 import android.app.Service;
 import android.content.Intent;
 import android.os.Handler;
@@ -47,7 +46,6 @@
  * </service>
  * @hide
  */
-@SystemApi
 public abstract class NetworkService extends Service {
 
     private final String TAG = NetworkService.class.getSimpleName();
diff --git a/telephony/java/android/telephony/NetworkServiceCallback.java b/telephony/java/android/telephony/NetworkServiceCallback.java
index dbad02f..ad3b00f 100644
--- a/telephony/java/android/telephony/NetworkServiceCallback.java
+++ b/telephony/java/android/telephony/NetworkServiceCallback.java
@@ -17,7 +17,6 @@
 package android.telephony;
 
 import android.annotation.IntDef;
-import android.annotation.SystemApi;
 import android.os.RemoteException;
 import android.telephony.NetworkService.NetworkServiceProvider;
 
@@ -33,7 +32,6 @@
  *
  * @hide
  */
-@SystemApi
 public class NetworkServiceCallback {
 
     private static final String mTag = NetworkServiceCallback.class.getSimpleName();
diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java
index fa7988d..8ffdb21 100644
--- a/telephony/java/android/telephony/ServiceState.java
+++ b/telephony/java/android/telephony/ServiceState.java
@@ -17,7 +17,6 @@
 package android.telephony;
 
 import android.annotation.IntDef;
-import android.annotation.SystemApi;
 import android.annotation.TestApi;
 import android.os.Bundle;
 import android.os.Parcel;
@@ -1534,7 +1533,6 @@
      * @return List of registration states
      * @hide
      */
-    @SystemApi
     public List<NetworkRegistrationState> getNetworkRegistrationStates() {
         synchronized (mNetworkRegistrationStates) {
             return new ArrayList<>(mNetworkRegistrationStates);
@@ -1548,7 +1546,6 @@
      * @return List of registration states.
      * @hide
      */
-    @SystemApi
     public List<NetworkRegistrationState> getNetworkRegistrationStates(int transportType) {
         List<NetworkRegistrationState> list = new ArrayList<>();
 
@@ -1571,7 +1568,6 @@
      * @return The matching NetworkRegistrationState.
      * @hide
      */
-    @SystemApi
     public NetworkRegistrationState getNetworkRegistrationStates(int transportType, int domain) {
         synchronized (mNetworkRegistrationStates) {
             for (NetworkRegistrationState networkRegistrationState : mNetworkRegistrationStates) {
diff --git a/telephony/java/android/telephony/SubscriptionPlan.java b/telephony/java/android/telephony/SubscriptionPlan.java
index ef2a364..e8bbe42 100644
--- a/telephony/java/android/telephony/SubscriptionPlan.java
+++ b/telephony/java/android/telephony/SubscriptionPlan.java
@@ -254,6 +254,9 @@
          * @param period The period after which the plan automatically recurs.
          */
         public static Builder createRecurring(ZonedDateTime start, Period period) {
+            if (period.isZero() || period.isNegative()) {
+                throw new IllegalArgumentException("Period " + period + " must be positive");
+            }
             return new Builder(start, null, period);
         }
 
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index a37c023..e098de9 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -2968,7 +2968,7 @@
             IPhoneSubInfo info = getSubscriberInfo();
             if (info == null)
                 return null;
-            return info.getGroupIdLevel1(mContext.getOpPackageName());
+            return info.getGroupIdLevel1ForSubscriber(getSubId(), mContext.getOpPackageName());
         } catch (RemoteException ex) {
             return null;
         } catch (NullPointerException ex) {
@@ -5523,6 +5523,7 @@
      * @deprecated
      * Use {@link
      * #requestNetworkScan(NetworkScanRequest, Executor, TelephonyScanManager.NetworkScanCallback)}
+     * @removed
      */
     @Deprecated
     @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
diff --git a/telephony/java/android/telephony/data/DataCallResponse.java b/telephony/java/android/telephony/data/DataCallResponse.java
index 25f5133..acc2470 100644
--- a/telephony/java/android/telephony/data/DataCallResponse.java
+++ b/telephony/java/android/telephony/data/DataCallResponse.java
@@ -19,7 +19,6 @@
 
 import android.annotation.NonNull;
 import android.annotation.Nullable;
-import android.annotation.SystemApi;
 import android.net.LinkAddress;
 import android.os.Parcel;
 import android.os.Parcelable;
@@ -34,7 +33,6 @@
  *
  * @hide
  */
-@SystemApi
 public final class DataCallResponse implements Parcelable {
     private final int mStatus;
     private final int mSuggestedRetryTime;
diff --git a/telephony/java/android/telephony/data/DataProfile.java b/telephony/java/android/telephony/data/DataProfile.java
index e8597b2..dd274c5 100644
--- a/telephony/java/android/telephony/data/DataProfile.java
+++ b/telephony/java/android/telephony/data/DataProfile.java
@@ -16,7 +16,6 @@
 
 package android.telephony.data;
 
-import android.annotation.SystemApi;
 import android.os.Build;
 import android.os.Parcel;
 import android.os.Parcelable;
@@ -30,7 +29,6 @@
  *
  * @hide
  */
-@SystemApi
 public final class DataProfile implements Parcelable {
 
     // The types indicating the data profile is used on GSM (3GPP) or CDMA (3GPP2) network.
diff --git a/telephony/java/android/telephony/data/DataService.java b/telephony/java/android/telephony/data/DataService.java
index 4ca5ce3..0835f7d 100644
--- a/telephony/java/android/telephony/data/DataService.java
+++ b/telephony/java/android/telephony/data/DataService.java
@@ -20,7 +20,6 @@
 import android.annotation.IntDef;
 import android.annotation.NonNull;
 import android.annotation.Nullable;
-import android.annotation.SystemApi;
 import android.app.Service;
 import android.content.Intent;
 import android.net.LinkProperties;
@@ -55,7 +54,6 @@
  * </service>
  * @hide
  */
-@SystemApi
 public abstract class DataService extends Service {
     private static final String TAG = DataService.class.getSimpleName();
 
diff --git a/telephony/java/android/telephony/data/DataServiceCallback.java b/telephony/java/android/telephony/data/DataServiceCallback.java
index 4af31b5..bff8260 100644
--- a/telephony/java/android/telephony/data/DataServiceCallback.java
+++ b/telephony/java/android/telephony/data/DataServiceCallback.java
@@ -17,7 +17,6 @@
 package android.telephony.data;
 
 import android.annotation.IntDef;
-import android.annotation.SystemApi;
 import android.net.LinkProperties;
 import android.os.RemoteException;
 import android.telephony.Rlog;
@@ -35,7 +34,6 @@
  *
  * @hide
  */
-@SystemApi
 public class DataServiceCallback {
 
     private static final String TAG = DataServiceCallback.class.getSimpleName();
@@ -125,7 +123,6 @@
      *
      * @param result The result code. Must be one of the {@link ResultCode}.
      */
-    @SystemApi
     public void onSetDataProfileComplete(@ResultCode int result) {
         IDataServiceCallback callback = mCallback.get();
         if (callback != null) {
diff --git a/telephony/java/android/telephony/mbms/DownloadRequest.java b/telephony/java/android/telephony/mbms/DownloadRequest.java
index 602c796..9e3302b 100644
--- a/telephony/java/android/telephony/mbms/DownloadRequest.java
+++ b/telephony/java/android/telephony/mbms/DownloadRequest.java
@@ -18,6 +18,7 @@
 
 import android.annotation.NonNull;
 import android.annotation.SystemApi;
+import android.annotation.TestApi;
 import android.content.Intent;
 import android.net.Uri;
 import android.os.Parcel;
@@ -184,6 +185,7 @@
          * @hide
          */
         @SystemApi
+        @TestApi
         public Builder setServiceId(String serviceId) {
             fileServiceId = serviceId;
             return this;
diff --git a/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl b/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl
index 0ed0820..93964f3 100644
--- a/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl
+++ b/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl
@@ -68,11 +68,6 @@
     String getSubscriberIdForSubscriber(int subId, String callingPackage);
 
     /**
-     * Retrieves the Group Identifier Level1 for GSM phones.
-     */
-    String getGroupIdLevel1(String callingPackage);
-
-    /**
      * Retrieves the Group Identifier Level1 for GSM phones of a subId.
      */
     String getGroupIdLevel1ForSubscriber(int subId, String callingPackage);
diff --git a/tools/apilint/apilint.py b/tools/apilint/apilint.py
index 26248e5..70a47cf 100644
--- a/tools/apilint/apilint.py
+++ b/tools/apilint/apilint.py
@@ -50,6 +50,18 @@
     return "\033[%sm" % (";".join(codes))
 
 
+def ident(raw):
+    """Strips superficial signature changes, giving us a strong key that
+    can be used to identify members across API levels."""
+    raw = raw.replace(" deprecated ", " ")
+    raw = raw.replace(" synchronized ", " ")
+    raw = raw.replace(" final ", " ")
+    raw = re.sub("<.+?>", "", raw)
+    if " throws " in raw:
+        raw = raw[:raw.index(" throws ")]
+    return raw
+
+
 class Field():
     def __init__(self, clazz, line, raw, blame):
         self.clazz = clazz
@@ -69,8 +81,7 @@
             self.value = raw[3].strip(';"')
         else:
             self.value = None
-
-        self.ident = self.raw.replace(" deprecated ", " ")
+        self.ident = ident(self.raw)
 
     def __hash__(self):
         return hash(self.raw)
@@ -105,15 +116,7 @@
         for r in raw[2:]:
             if r == "throws": target = self.throws
             else: target.append(r)
-
-        # identity for compat purposes
-        ident = self.raw
-        ident = ident.replace(" deprecated ", " ")
-        ident = ident.replace(" synchronized ", " ")
-        ident = re.sub("<.+?>", "", ident)
-        if " throws " in ident:
-            ident = ident[:ident.index(" throws ")]
-        self.ident = ident
+        self.ident = ident(self.raw)
 
     def __hash__(self):
         return hash(self.raw)
@@ -1469,6 +1472,40 @@
     return failures
 
 
+def show_deprecations_at_birth(cur, prev):
+    """Show API deprecations at birth."""
+    global failures
+
+    # Remove all existing things so we're left with new
+    for prev_clazz in prev.values():
+        cur_clazz = cur[prev_clazz.fullname]
+
+        sigs = { i.ident: i for i in prev_clazz.ctors }
+        cur_clazz.ctors = [ i for i in cur_clazz.ctors if i.ident not in sigs ]
+        sigs = { i.ident: i for i in prev_clazz.methods }
+        cur_clazz.methods = [ i for i in cur_clazz.methods if i.ident not in sigs ]
+        sigs = { i.ident: i for i in prev_clazz.fields }
+        cur_clazz.fields = [ i for i in cur_clazz.fields if i.ident not in sigs ]
+
+        # Forget about class entirely when nothing new
+        if len(cur_clazz.ctors) == 0 and len(cur_clazz.methods) == 0 and len(cur_clazz.fields) == 0:
+            del cur[prev_clazz.fullname]
+
+    for clazz in cur.values():
+        if " deprecated " in clazz.raw and not clazz.fullname in prev:
+            error(clazz, None, None, "Found API deprecation at birth")
+
+        for i in clazz.ctors + clazz.methods + clazz.fields:
+            if " deprecated " in i.raw:
+                error(clazz, i, None, "Found API deprecation at birth")
+
+    print "%s Deprecated at birth %s\n" % ((format(fg=WHITE, bg=BLUE, bold=True),
+                                            format(reset=True)))
+    for f in sorted(failures):
+        print failures[f]
+        print
+
+
 if __name__ == "__main__":
     parser = argparse.ArgumentParser(description="Enforces common Android public API design \
             patterns. It ignores lint messages from a previous API level, if provided.")
@@ -1481,6 +1518,8 @@
             help="Allow references to Google")
     parser.add_argument("--show-noticed", action='store_const', const=True,
             help="Show API changes noticed")
+    parser.add_argument("--show-deprecations-at-birth", action='store_const', const=True,
+            help="Show API deprecations at birth")
     args = vars(parser.parse_args())
 
     if args['no_color']:
@@ -1492,6 +1531,14 @@
     current_file = args['current.txt']
     previous_file = args['previous.txt']
 
+    if args['show_deprecations_at_birth']:
+        with current_file as f:
+            cur = _parse_stream(f)
+        with previous_file as f:
+            prev = _parse_stream(f)
+        show_deprecations_at_birth(cur, prev)
+        sys.exit()
+
     with current_file as f:
         cur_fail, cur_noticed = examine_stream(f)
     if not previous_file is None: