Merge "Formalize recents component in the system"
diff --git a/core/java/android/service/autofill/SaveInfo.java b/core/java/android/service/autofill/SaveInfo.java
index fde2416..9a1dcbb 100644
--- a/core/java/android/service/autofill/SaveInfo.java
+++ b/core/java/android/service/autofill/SaveInfo.java
@@ -535,14 +535,15 @@
* 16 digits, or 15 digits starting with 108:
*
* <pre class="prettyprint">
- * import android.service.autofill.Validators;
+ * import static android.service.autofill.Validators.and;
+ * import static android.service.autofill.Validators.or;
*
* Validator validator =
* and(
* new LuhnChecksumValidator(ccNumberId),
* or(
- * new RegexValidator(ccNumberId, Pattern.compile(""^\\d{16}$")),
- * new RegexValidator(ccNumberId, Pattern.compile(""^108\\d{12}$"))
+ * new RegexValidator(ccNumberId, Pattern.compile("^\\d{16}$")),
+ * new RegexValidator(ccNumberId, Pattern.compile("^108\\d{12}$"))
* )
* );
* </pre>
@@ -562,14 +563,14 @@
* 4 digits on each field:
*
* <pre class="prettyprint">
- * import android.service.autofill.Validators;
+ * import static android.service.autofill.Validators.and;
*
* Validator validator =
* and(
- * new RegexValidator(ccNumberId1, Pattern.compile(""^\\d{4}$")),
- * new RegexValidator(ccNumberId2, Pattern.compile(""^\\d{4}$")),
- * new RegexValidator(ccNumberId3, Pattern.compile(""^\\d{4}$")),
- * new RegexValidator(ccNumberId4, Pattern.compile(""^\\d{4}$"))
+ * new RegexValidator(ccNumberId1, Pattern.compile("^\\d{4}$")),
+ * new RegexValidator(ccNumberId2, Pattern.compile("^\\d{4}$")),
+ * new RegexValidator(ccNumberId3, Pattern.compile("^\\d{4}$")),
+ * new RegexValidator(ccNumberId4, Pattern.compile("^\\d{4}$"))
* );
* </pre>
*
diff --git a/core/java/android/webkit/MimeTypeMap.java b/core/java/android/webkit/MimeTypeMap.java
index 39874e8..3861695 100644
--- a/core/java/android/webkit/MimeTypeMap.java
+++ b/core/java/android/webkit/MimeTypeMap.java
@@ -37,7 +37,7 @@
}
/**
- * Returns the file extension or an empty string iff there is no
+ * Returns the file extension or an empty string if there is no
* extension. This method is a convenience method for obtaining the
* extension of a url and has undefined results for other Strings.
* @param url
@@ -76,7 +76,7 @@
/**
* Return {@code true} if the given MIME type has an entry in the map.
* @param mimeType A MIME type (i.e. text/plain)
- * @return {@code true} iff there is a mimeType entry in the map.
+ * @return {@code true} if there is a mimeType entry in the map.
*/
public boolean hasMimeType(String mimeType) {
return MimeUtils.hasMimeType(mimeType);
@@ -85,7 +85,7 @@
/**
* Return the MIME type for the given extension.
* @param extension A file extension without the leading '.'
- * @return The MIME type for the given extension or {@code null} iff there is none.
+ * @return The MIME type for the given extension or {@code null} if there is none.
*/
@Nullable
public String getMimeTypeFromExtension(String extension) {
@@ -100,7 +100,7 @@
/**
* Return {@code true} if the given extension has a registered MIME type.
* @param extension A file extension without the leading '.'
- * @return {@code true} iff there is an extension entry in the map.
+ * @return {@code true} if there is an extension entry in the map.
*/
public boolean hasExtension(String extension) {
return MimeUtils.hasExtension(extension);
@@ -111,7 +111,7 @@
* MIME types map to multiple extensions. This call will return the most
* common extension for the given MIME type.
* @param mimeType A MIME type (i.e. text/plain)
- * @return The extension for the given MIME type or {@code null} iff there is none.
+ * @return The extension for the given MIME type or {@code null} if there is none.
*/
@Nullable
public String getExtensionFromMimeType(String mimeType) {
diff --git a/core/java/android/webkit/URLUtil.java b/core/java/android/webkit/URLUtil.java
index c2f121a..84c000a 100644
--- a/core/java/android/webkit/URLUtil.java
+++ b/core/java/android/webkit/URLUtil.java
@@ -137,7 +137,7 @@
}
/**
- * @return {@code true} iff the url is correctly URL encoded
+ * @return {@code true} if the url is correctly URL encoded
*/
static boolean verifyURLEncoding(String url) {
int count = url.length();
@@ -171,14 +171,14 @@
}
/**
- * @return {@code true} iff the url is an asset file.
+ * @return {@code true} if the url is an asset file.
*/
public static boolean isAssetUrl(String url) {
return (null != url) && url.startsWith(ASSET_BASE);
}
/**
- * @return {@code true} iff the url is a resource file.
+ * @return {@code true} if the url is a resource file.
* @hide
*/
public static boolean isResourceUrl(String url) {
@@ -186,7 +186,7 @@
}
/**
- * @return {@code true} iff the url is a proxy url to allow cookieless network
+ * @return {@code true} if the url is a proxy url to allow cookieless network
* requests from a file url.
* @deprecated Cookieless proxy is no longer supported.
*/
@@ -196,7 +196,7 @@
}
/**
- * @return {@code true} iff the url is a local file.
+ * @return {@code true} if the url is a local file.
*/
public static boolean isFileUrl(String url) {
return (null != url) && (url.startsWith(FILE_BASE) &&
@@ -205,28 +205,28 @@
}
/**
- * @return {@code true} iff the url is an about: url.
+ * @return {@code true} if the url is an about: url.
*/
public static boolean isAboutUrl(String url) {
return (null != url) && url.startsWith("about:");
}
/**
- * @return {@code true} iff the url is a data: url.
+ * @return {@code true} if the url is a data: url.
*/
public static boolean isDataUrl(String url) {
return (null != url) && url.startsWith("data:");
}
/**
- * @return {@code true} iff the url is a javascript: url.
+ * @return {@code true} if the url is a javascript: url.
*/
public static boolean isJavaScriptUrl(String url) {
return (null != url) && url.startsWith("javascript:");
}
/**
- * @return {@code true} iff the url is an http: url.
+ * @return {@code true} if the url is an http: url.
*/
public static boolean isHttpUrl(String url) {
return (null != url) &&
@@ -235,7 +235,7 @@
}
/**
- * @return {@code true} iff the url is an https: url.
+ * @return {@code true} if the url is an https: url.
*/
public static boolean isHttpsUrl(String url) {
return (null != url) &&
@@ -244,7 +244,7 @@
}
/**
- * @return {@code true} iff the url is a network url.
+ * @return {@code true} if the url is a network url.
*/
public static boolean isNetworkUrl(String url) {
if (url == null || url.length() == 0) {
@@ -254,14 +254,14 @@
}
/**
- * @return {@code true} iff the url is a content: url.
+ * @return {@code true} if the url is a content: url.
*/
public static boolean isContentUrl(String url) {
return (null != url) && url.startsWith(CONTENT_BASE);
}
/**
- * @return {@code true} iff the url is valid.
+ * @return {@code true} if the url is valid.
*/
public static boolean isValidUrl(String url) {
if (url == null || url.length() == 0) {
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index dfc81b2..259bf60 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -1103,7 +1103,7 @@
/**
* Gets whether this WebView has a back history item.
*
- * @return {@code true} iff this WebView has a back history item
+ * @return {@code true} if this WebView has a back history item
*/
public boolean canGoBack() {
checkThread();
@@ -1121,7 +1121,7 @@
/**
* Gets whether this WebView has a forward history item.
*
- * @return {@code true} iff this WebView has a forward history item
+ * @return {@code true} if this WebView has a forward history item
*/
public boolean canGoForward() {
checkThread();
diff --git a/core/java/android/webkit/WebViewFactory.java b/core/java/android/webkit/WebViewFactory.java
index 48e427f..797bdfb 100644
--- a/core/java/android/webkit/WebViewFactory.java
+++ b/core/java/android/webkit/WebViewFactory.java
@@ -137,7 +137,7 @@
}
/**
- * Load the native library for the given package name iff that package
+ * Load the native library for the given package name if that package
* name is the same as the one providing the webview.
*/
public static int loadWebViewNativeLibraryFromPackage(String packageName,
diff --git a/core/proto/android/server/powermanagerservice.proto b/core/proto/android/server/powermanagerservice.proto
index 70a285d..d442acf 100644
--- a/core/proto/android/server/powermanagerservice.proto
+++ b/core/proto/android/server/powermanagerservice.proto
@@ -30,6 +30,7 @@
import "frameworks/base/core/proto/android/view/display.proto";
message PowerManagerServiceDumpProto {
+ // A com.android.server.power.PowerManagerService.Constants object.
message ConstantsProto {
optional bool is_no_cached_wake_locks = 1;
}
@@ -49,7 +50,8 @@
optional bool is_screen_dim = 2;
optional bool is_screen_dream = 3;
}
- message UidProto {
+ // A com.android.server.power.PowerManagerService.UidState object.
+ message UidStateProto {
optional int32 uid = 1;
optional string uid_string = 2;
optional bool is_active = 3;
@@ -154,7 +156,7 @@
// Some uids have actually changed while mUidsChanging was true.
optional bool are_uids_changed = 45;
// List of UIDs and their states
- repeated UidProto uids = 46;
+ repeated UidStateProto uid_states = 46;
optional .android.os.LooperProto looper = 47;
// List of all wake locks acquired by applications.
repeated WakeLockProto wake_locks = 48;
@@ -163,11 +165,13 @@
optional WirelessChargerDetectorProto wireless_charger_detector = 50;
}
+// A com.android.server.power.PowerManagerService.SuspendBlockerImpl object.
message SuspendBlockerProto {
optional string name = 1;
optional int32 reference_count = 2;
}
+// A com.android.server.power.PowerManagerService.WakeLock object.
message WakeLockProto {
message WakeLockFlagsProto {
// Turn the screen on when the wake lock is acquired.
diff --git a/proto/src/metrics_constants.proto b/proto/src/metrics_constants.proto
index 5dd3620..93aa520 100644
--- a/proto/src/metrics_constants.proto
+++ b/proto/src/metrics_constants.proto
@@ -4704,6 +4704,11 @@
// OS: P
AUTOFILL_SAVE_EXPLICITLY_TRIGGERED = 1229;
+ // OPEN: Settings > Network & Internet > Mobile network > Wi-Fi calling
+ // CATEGORY: SETTINGS
+ // OS: P
+ WIFI_CALLING_FOR_SUB = 1230;
+
// Add new aosp constants above this line.
// END OF AOSP CONSTANTS
}
diff --git a/services/core/java/com/android/server/am/ActivityDisplay.java b/services/core/java/com/android/server/am/ActivityDisplay.java
index 29073cb..c04ddf8 100644
--- a/services/core/java/com/android/server/am/ActivityDisplay.java
+++ b/services/core/java/com/android/server/am/ActivityDisplay.java
@@ -604,7 +604,7 @@
public void writeToProto(ProtoOutputStream proto, long fieldId) {
final long token = proto.start(fieldId);
- super.writeToProto(proto, CONFIGURATION_CONTAINER);
+ super.writeToProto(proto, CONFIGURATION_CONTAINER, false /* trim */);
proto.write(ID, mDisplayId);
for (int stackNdx = mStacks.size() - 1; stackNdx >= 0; --stackNdx) {
final ActivityStack stack = mStacks.get(stackNdx);
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 0f68e3c..93c0a39 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -2038,7 +2038,9 @@
synchronized (ActivityManagerService.this) {
for (int i = mLruProcesses.size() - 1 ; i >= 0 ; i--) {
ProcessRecord r = mLruProcesses.get(i);
- if (r.thread != null) {
+ // Don't dispatch to isolated processes as they can't access
+ // ConnectivityManager and don't have network privileges anyway.
+ if (r.thread != null && !r.isolated) {
try {
r.thread.setHttpProxy(host, port, exclList, pacFileUrl);
} catch (RemoteException ex) {
diff --git a/services/core/java/com/android/server/am/ActivityRecord.java b/services/core/java/com/android/server/am/ActivityRecord.java
index 61c226d..2f0b649 100644
--- a/services/core/java/com/android/server/am/ActivityRecord.java
+++ b/services/core/java/com/android/server/am/ActivityRecord.java
@@ -2810,7 +2810,7 @@
public void writeToProto(ProtoOutputStream proto, long fieldId) {
final long token = proto.start(fieldId);
- super.writeToProto(proto, CONFIGURATION_CONTAINER);
+ super.writeToProto(proto, CONFIGURATION_CONTAINER, false /* trim */);
writeIdentifierToProto(proto, IDENTIFIER);
proto.write(STATE, state.toString());
proto.write(VISIBLE, visible);
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index 83917ac..ba41bd4 100644
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -4999,7 +4999,7 @@
public void writeToProto(ProtoOutputStream proto, long fieldId) {
final long token = proto.start(fieldId);
- super.writeToProto(proto, CONFIGURATION_CONTAINER);
+ super.writeToProto(proto, CONFIGURATION_CONTAINER, false /* trim */);
proto.write(ID, mStackId);
for (int taskNdx = mTaskHistory.size() - 1; taskNdx >= 0; --taskNdx) {
final TaskRecord task = mTaskHistory.get(taskNdx);
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
index 0c8d039..6ec158e 100644
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -3676,7 +3676,7 @@
}
public void writeToProto(ProtoOutputStream proto) {
- super.writeToProto(proto, CONFIGURATION_CONTAINER);
+ super.writeToProto(proto, CONFIGURATION_CONTAINER, false /* trim */);
for (int displayNdx = 0; displayNdx < mActivityDisplays.size(); ++displayNdx) {
ActivityDisplay activityDisplay = mActivityDisplays.valueAt(displayNdx);
activityDisplay.writeToProto(proto, DISPLAYS);
diff --git a/services/core/java/com/android/server/am/TaskRecord.java b/services/core/java/com/android/server/am/TaskRecord.java
index 6bf373b..1b5a1ce 100644
--- a/services/core/java/com/android/server/am/TaskRecord.java
+++ b/services/core/java/com/android/server/am/TaskRecord.java
@@ -2236,7 +2236,7 @@
public void writeToProto(ProtoOutputStream proto, long fieldId) {
final long token = proto.start(fieldId);
- super.writeToProto(proto, CONFIGURATION_CONTAINER);
+ super.writeToProto(proto, CONFIGURATION_CONTAINER, false /* trim */);
proto.write(ID, taskId);
for (int i = mActivities.size() - 1; i >= 0; i--) {
ActivityRecord activity = mActivities.get(i);
diff --git a/services/core/java/com/android/server/pm/permission/PermissionManagerService.java b/services/core/java/com/android/server/pm/permission/PermissionManagerService.java
index abe4f5e..9e49409 100644
--- a/services/core/java/com/android/server/pm/permission/PermissionManagerService.java
+++ b/services/core/java/com/android/server/pm/permission/PermissionManagerService.java
@@ -288,7 +288,21 @@
final String[] packages = mContext.getPackageManager().getPackagesForUid(uid);
if (packages != null && packages.length > 0) {
- final PackageParser.Package pkg = mPackageManagerInt.getPackage(packages[0]);
+Slog.e(TAG, "TODD: Packages: " + Arrays.toString(packages));
+ PackageParser.Package pkg = null;
+ for (String packageName : packages) {
+ pkg = mPackageManagerInt.getPackage(packageName);
+ if (pkg != null) {
+Slog.e(TAG, "TODD: Using packge: " + packageName);
+ break;
+ } else {
+Slog.e(TAG, "TODD: Missing packge: " + packageName);
+ }
+ }
+ if (pkg == null) {
+Slog.e(TAG, "TODD: No package not found; UID: " + uid);
+ return PackageManager.PERMISSION_DENIED;
+ }
if (pkg.mSharedUserId != null) {
if (isCallerInstantApp) {
return PackageManager.PERMISSION_DENIED;
diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java
index a95a539d..2494bde 100644
--- a/services/core/java/com/android/server/power/PowerManagerService.java
+++ b/services/core/java/com/android/server/power/PowerManagerService.java
@@ -3702,16 +3702,16 @@
for (int i = 0; i < mUidState.size(); i++) {
final UidState state = mUidState.valueAt(i);
- final long uIDToken = proto.start(PowerManagerServiceDumpProto.UIDS);
+ final long uIDToken = proto.start(PowerManagerServiceDumpProto.UID_STATES);
final int uid = mUidState.keyAt(i);
- proto.write(PowerManagerServiceDumpProto.UidProto.UID, uid);
- proto.write(PowerManagerServiceDumpProto.UidProto.UID_STRING, UserHandle.formatUid(uid));
- proto.write(PowerManagerServiceDumpProto.UidProto.IS_ACTIVE, state.mActive);
- proto.write(PowerManagerServiceDumpProto.UidProto.NUM_WAKE_LOCKS, state.mNumWakeLocks);
+ proto.write(PowerManagerServiceDumpProto.UidStateProto.UID, uid);
+ proto.write(PowerManagerServiceDumpProto.UidStateProto.UID_STRING, UserHandle.formatUid(uid));
+ proto.write(PowerManagerServiceDumpProto.UidStateProto.IS_ACTIVE, state.mActive);
+ proto.write(PowerManagerServiceDumpProto.UidStateProto.NUM_WAKE_LOCKS, state.mNumWakeLocks);
if (state.mProcState == ActivityManager.PROCESS_STATE_UNKNOWN) {
- proto.write(PowerManagerServiceDumpProto.UidProto.IS_PROCESS_STATE_UNKNOWN, true);
+ proto.write(PowerManagerServiceDumpProto.UidStateProto.IS_PROCESS_STATE_UNKNOWN, true);
} else {
- proto.write(PowerManagerServiceDumpProto.UidProto.PROCESS_STATE,
+ proto.write(PowerManagerServiceDumpProto.UidStateProto.PROCESS_STATE,
ActivityManager.processStateAmToProto(state.mProcState));
}
proto.end(uIDToken);
diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java
index 5d03493..e873d32 100644
--- a/services/core/java/com/android/server/wm/AppWindowToken.java
+++ b/services/core/java/com/android/server/wm/AppWindowToken.java
@@ -1621,10 +1621,10 @@
@CallSuper
@Override
- public void writeToProto(ProtoOutputStream proto, long fieldId) {
+ public void writeToProto(ProtoOutputStream proto, long fieldId, boolean trim) {
final long token = proto.start(fieldId);
writeNameToProto(proto, NAME);
- super.writeToProto(proto, WINDOW_TOKEN);
+ super.writeToProto(proto, WINDOW_TOKEN, trim);
proto.end(token);
}
diff --git a/services/core/java/com/android/server/wm/ConfigurationContainer.java b/services/core/java/com/android/server/wm/ConfigurationContainer.java
index a4ab3ba..cc94807 100644
--- a/services/core/java/com/android/server/wm/ConfigurationContainer.java
+++ b/services/core/java/com/android/server/wm/ConfigurationContainer.java
@@ -50,6 +50,9 @@
/** Contains override configuration settings applied to this configuration container. */
private Configuration mOverrideConfiguration = new Configuration();
+ /** True if mOverrideConfiguration is not empty */
+ private boolean mHasOverrideConfiguration;
+
/**
* Contains full configuration applied to this configuration container. Corresponds to full
* parent's config with applied {@link #mOverrideConfiguration}.
@@ -101,6 +104,9 @@
* @see #mFullConfiguration
*/
public void onOverrideConfigurationChanged(Configuration overrideConfiguration) {
+ // Pre-compute this here, so we don't need to go through the entire Configuration when
+ // writing to proto (which has significant cost if we write a lot of empty configurations).
+ mHasOverrideConfiguration = !Configuration.EMPTY.equals(overrideConfiguration);
mOverrideConfiguration.setTo(overrideConfiguration);
// Update full configuration of this container and all its children.
final ConfigurationContainer parent = getParent();
@@ -330,18 +336,23 @@
* Write to a protocol buffer output stream. Protocol buffer message definition is at
* {@link com.android.server.wm.proto.ConfigurationContainerProto}.
*
- * @param protoOutputStream Stream to write the ConfigurationContainer object to.
- * @param fieldId Field Id of the ConfigurationContainer as defined in the parent
- * message.
+ * @param proto Stream to write the ConfigurationContainer object to.
+ * @param fieldId Field Id of the ConfigurationContainer as defined in the parent
+ * message.
+ * @param trim If true, reduce amount of data written.
* @hide
*/
@CallSuper
- public void writeToProto(ProtoOutputStream protoOutputStream, long fieldId) {
- final long token = protoOutputStream.start(fieldId);
- mOverrideConfiguration.writeToProto(protoOutputStream, OVERRIDE_CONFIGURATION);
- mFullConfiguration.writeToProto(protoOutputStream, FULL_CONFIGURATION);
- mMergedOverrideConfiguration.writeToProto(protoOutputStream, MERGED_OVERRIDE_CONFIGURATION);
- protoOutputStream.end(token);
+ public void writeToProto(ProtoOutputStream proto, long fieldId, boolean trim) {
+ final long token = proto.start(fieldId);
+ if (!trim || mHasOverrideConfiguration) {
+ mOverrideConfiguration.writeToProto(proto, OVERRIDE_CONFIGURATION);
+ }
+ if (!trim) {
+ mFullConfiguration.writeToProto(proto, FULL_CONFIGURATION);
+ mMergedOverrideConfiguration.writeToProto(proto, MERGED_OVERRIDE_CONFIGURATION);
+ }
+ proto.end(token);
}
/**
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index 03fdc96..4c6ab3f 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -2137,27 +2137,27 @@
@CallSuper
@Override
- public void writeToProto(ProtoOutputStream proto, long fieldId) {
+ public void writeToProto(ProtoOutputStream proto, long fieldId, boolean trim) {
final long token = proto.start(fieldId);
- super.writeToProto(proto, WINDOW_CONTAINER);
+ super.writeToProto(proto, WINDOW_CONTAINER, trim);
proto.write(ID, mDisplayId);
for (int stackNdx = mTaskStackContainers.getChildCount() - 1; stackNdx >= 0; --stackNdx) {
final TaskStack stack = mTaskStackContainers.getChildAt(stackNdx);
- stack.writeToProto(proto, STACKS);
+ stack.writeToProto(proto, STACKS, trim);
}
mDividerControllerLocked.writeToProto(proto, DOCKED_STACK_DIVIDER_CONTROLLER);
mPinnedStackControllerLocked.writeToProto(proto, PINNED_STACK_CONTROLLER);
for (int i = mAboveAppWindowsContainers.getChildCount() - 1; i >= 0; --i) {
final WindowToken windowToken = mAboveAppWindowsContainers.getChildAt(i);
- windowToken.writeToProto(proto, ABOVE_APP_WINDOWS);
+ windowToken.writeToProto(proto, ABOVE_APP_WINDOWS, trim);
}
for (int i = mBelowAppWindowsContainers.getChildCount() - 1; i >= 0; --i) {
final WindowToken windowToken = mBelowAppWindowsContainers.getChildAt(i);
- windowToken.writeToProto(proto, BELOW_APP_WINDOWS);
+ windowToken.writeToProto(proto, BELOW_APP_WINDOWS, trim);
}
for (int i = mImeWindowsContainers.getChildCount() - 1; i >= 0; --i) {
final WindowToken windowToken = mImeWindowsContainers.getChildAt(i);
- windowToken.writeToProto(proto, IME_WINDOWS);
+ windowToken.writeToProto(proto, IME_WINDOWS, trim);
}
proto.write(DPI, mBaseDisplayDensity);
mDisplayInfo.writeToProto(proto, DISPLAY_INFO);
diff --git a/services/core/java/com/android/server/wm/RootWindowContainer.java b/services/core/java/com/android/server/wm/RootWindowContainer.java
index fd57470..a710441 100644
--- a/services/core/java/com/android/server/wm/RootWindowContainer.java
+++ b/services/core/java/com/android/server/wm/RootWindowContainer.java
@@ -1081,19 +1081,21 @@
@CallSuper
@Override
- public void writeToProto(ProtoOutputStream proto, long fieldId) {
+ public void writeToProto(ProtoOutputStream proto, long fieldId, boolean trim) {
final long token = proto.start(fieldId);
- super.writeToProto(proto, WINDOW_CONTAINER);
+ super.writeToProto(proto, WINDOW_CONTAINER, trim);
if (mService.mDisplayReady) {
final int count = mChildren.size();
for (int i = 0; i < count; ++i) {
final DisplayContent displayContent = mChildren.get(i);
- displayContent.writeToProto(proto, DISPLAYS);
+ displayContent.writeToProto(proto, DISPLAYS, trim);
}
}
- forAllWindows((w) -> {
- w.writeIdentifierToProto(proto, WINDOWS);
- }, true);
+ if (!trim) {
+ forAllWindows((w) -> {
+ w.writeIdentifierToProto(proto, WINDOWS);
+ }, true);
+ }
proto.end(token);
}
diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java
index 891d637a..7620cb0 100644
--- a/services/core/java/com/android/server/wm/Task.java
+++ b/services/core/java/com/android/server/wm/Task.java
@@ -725,13 +725,13 @@
@CallSuper
@Override
- public void writeToProto(ProtoOutputStream proto, long fieldId) {
+ public void writeToProto(ProtoOutputStream proto, long fieldId, boolean trim) {
final long token = proto.start(fieldId);
- super.writeToProto(proto, WINDOW_CONTAINER);
+ super.writeToProto(proto, WINDOW_CONTAINER, trim);
proto.write(ID, mTaskId);
for (int i = mChildren.size() - 1; i >= 0; i--) {
final AppWindowToken appWindowToken = mChildren.get(i);
- appWindowToken.writeToProto(proto, APP_WINDOW_TOKENS);
+ appWindowToken.writeToProto(proto, APP_WINDOW_TOKENS, trim);
}
proto.write(FILLS_PARENT, mFillsParent);
mBounds.writeToProto(proto, BOUNDS);
diff --git a/services/core/java/com/android/server/wm/TaskStack.java b/services/core/java/com/android/server/wm/TaskStack.java
index 3320274..791accf 100644
--- a/services/core/java/com/android/server/wm/TaskStack.java
+++ b/services/core/java/com/android/server/wm/TaskStack.java
@@ -1232,12 +1232,12 @@
@CallSuper
@Override
- public void writeToProto(ProtoOutputStream proto, long fieldId) {
+ public void writeToProto(ProtoOutputStream proto, long fieldId, boolean trim) {
final long token = proto.start(fieldId);
- super.writeToProto(proto, WINDOW_CONTAINER);
+ super.writeToProto(proto, WINDOW_CONTAINER, trim);
proto.write(ID, mStackId);
for (int taskNdx = mChildren.size() - 1; taskNdx >= 0; taskNdx--) {
- mChildren.get(taskNdx).writeToProto(proto, TASKS);
+ mChildren.get(taskNdx).writeToProto(proto, TASKS, trim);
}
proto.write(FILLS_PARENT, mFillsParent);
mBounds.writeToProto(proto, BOUNDS);
diff --git a/services/core/java/com/android/server/wm/WindowContainer.java b/services/core/java/com/android/server/wm/WindowContainer.java
index 563eb9c..8f4b897 100644
--- a/services/core/java/com/android/server/wm/WindowContainer.java
+++ b/services/core/java/com/android/server/wm/WindowContainer.java
@@ -677,17 +677,18 @@
* Write to a protocol buffer output stream. Protocol buffer message definition is at
* {@link com.android.server.wm.proto.WindowContainerProto}.
*
- * @param protoOutputStream Stream to write the WindowContainer object to.
- * @param fieldId Field Id of the WindowContainer as defined in the parent message.
+ * @param proto Stream to write the WindowContainer object to.
+ * @param fieldId Field Id of the WindowContainer as defined in the parent message.
+ * @param trim If true, reduce the amount of data written.
* @hide
*/
@CallSuper
@Override
- public void writeToProto(ProtoOutputStream protoOutputStream, long fieldId) {
- final long token = protoOutputStream.start(fieldId);
- super.writeToProto(protoOutputStream, CONFIGURATION_CONTAINER);
- protoOutputStream.write(ORIENTATION, mOrientation);
- protoOutputStream.end(token);
+ public void writeToProto(ProtoOutputStream proto, long fieldId, boolean trim) {
+ final long token = proto.start(fieldId);
+ super.writeToProto(proto, CONFIGURATION_CONTAINER, trim);
+ proto.write(ORIENTATION, mOrientation);
+ proto.end(token);
}
private ForAllWindowsConsumerWrapper obtainConsumerWrapper(Consumer<WindowState> consumer) {
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index 70d0616..ad6fc39 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -6430,9 +6430,16 @@
}
}
- private void writeToProtoLocked(ProtoOutputStream proto) {
+ /**
+ * Write to a protocol buffer output stream. Protocol buffer message definition is at
+ * {@link com.android.server.wm.proto.WindowManagerServiceProto}.
+ *
+ * @param proto Stream to write the WindowContainer object to.
+ * @param trim If true, reduce the amount of data written.
+ */
+ private void writeToProtoLocked(ProtoOutputStream proto, boolean trim) {
mPolicy.writeToProto(proto, POLICY);
- mRoot.writeToProto(proto, ROOT_WINDOW_CONTAINER);
+ mRoot.writeToProto(proto, ROOT_WINDOW_CONTAINER, trim);
if (mCurrentFocus != null) {
mCurrentFocus.writeIdentifierToProto(proto, FOCUSED_WINDOW);
}
@@ -6768,7 +6775,7 @@
if (useProto) {
final ProtoOutputStream proto = new ProtoOutputStream(fd);
synchronized (mWindowMap) {
- writeToProtoLocked(proto);
+ writeToProtoLocked(proto, false /* trim */);
}
proto.flush();
return;
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index e171528..4370a76 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -3120,9 +3120,9 @@
@CallSuper
@Override
- public void writeToProto(ProtoOutputStream proto, long fieldId) {
+ public void writeToProto(ProtoOutputStream proto, long fieldId, boolean trim) {
final long token = proto.start(fieldId);
- super.writeToProto(proto, WINDOW_CONTAINER);
+ super.writeToProto(proto, WINDOW_CONTAINER, trim);
writeIdentifierToProto(proto, IDENTIFIER);
proto.write(DISPLAY_ID, getDisplayId());
proto.write(STACK_ID, getStackId());
@@ -3137,7 +3137,7 @@
mWinAnimator.writeToProto(proto, ANIMATOR);
proto.write(ANIMATING_EXIT, mAnimatingExit);
for (int i = 0; i < mChildren.size(); i++) {
- mChildren.get(i).writeToProto(proto, CHILD_WINDOWS);
+ mChildren.get(i).writeToProto(proto, CHILD_WINDOWS, trim);
}
proto.end(token);
}
diff --git a/services/core/java/com/android/server/wm/WindowToken.java b/services/core/java/com/android/server/wm/WindowToken.java
index 943448e..62a2abb 100644
--- a/services/core/java/com/android/server/wm/WindowToken.java
+++ b/services/core/java/com/android/server/wm/WindowToken.java
@@ -267,13 +267,13 @@
@CallSuper
@Override
- public void writeToProto(ProtoOutputStream proto, long fieldId) {
+ public void writeToProto(ProtoOutputStream proto, long fieldId, boolean trim) {
final long token = proto.start(fieldId);
- super.writeToProto(proto, WINDOW_CONTAINER);
+ super.writeToProto(proto, WINDOW_CONTAINER, trim);
proto.write(HASH_CODE, System.identityHashCode(this));
for (int i = 0; i < mChildren.size(); i++) {
final WindowState w = mChildren.get(i);
- w.writeToProto(proto, WINDOWS);
+ w.writeToProto(proto, WINDOWS, trim);
}
proto.end(token);
}