diff options
| author | 2024-08-14 16:15:53 +0800 | |
|---|---|---|
| committer | 2024-09-24 11:41:09 +0000 | |
| commit | 36ed35e30511d045d815aa271c3806b1f32d5271 (patch) | |
| tree | bea6cf8734510e266eb3eb3d36eb29494f31959f | |
| parent | b90b46a543cac12c0025dc5639ad52410fc51d6e (diff) | |
[Binder][XIAOMI][Bugfix] Skip appops header in native parcel. [1/2]
The same way as strict mode header.
Bug: 359692915
Test: atest binderUnitTest
Change-Id: Id4d20ecd5b3445ebe59519472fe99bf84a1faf44
| -rw-r--r-- | core/java/android/app/AppOpsManager.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/core/java/android/app/AppOpsManager.java b/core/java/android/app/AppOpsManager.java index 2afc78cb90e6..11e464f5c07c 100644 --- a/core/java/android/app/AppOpsManager.java +++ b/core/java/android/app/AppOpsManager.java @@ -10119,6 +10119,9 @@ public class AppOpsManager { } p.writeInt(Parcel.EX_HAS_NOTED_APPOPS_REPLY_HEADER); + final int sizePosition = p.dataPosition(); + // Write size placeholder. With this size we can easily skip it in native. + p.writeInt(0); int numAttributionWithNotesAppOps = notedAppOps.size(); p.writeInt(numAttributionWithNotesAppOps); @@ -10135,6 +10138,12 @@ public class AppOpsManager { } } } + + final int payloadPosition = p.dataPosition(); + p.setDataPosition(sizePosition); + // Total header size including 4 bytes size itself. + p.writeInt(payloadPosition - sizePosition); + p.setDataPosition(payloadPosition); } /** @@ -10148,6 +10157,8 @@ public class AppOpsManager { * @hide */ public static void readAndLogNotedAppops(@NonNull Parcel p) { + // Skip size. + p.readInt(); int numAttributionsWithNotedAppOps = p.readInt(); for (int i = 0; i < numAttributionsWithNotedAppOps; i++) { |