Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9be540ab authored by Sandeep Bandaru's avatar Sandeep Bandaru
Browse files

Move `sanitizeStateParams` ahead of Bundle modifications

Currently, if Bundle has to check for `hasBinders`, the bundle has to be in parcelled state. By adding a remove(key), Bundle was unparcelled and it led to crash for that reason.

Added a TODO to followup with more robust exception handling in this scenario to not crash.

Change-Id: I2ca25503944c8beaef103f419a9472468cee7988
Flag: EXEMPT bugfix
Bug: 372658837
parent 4a8d23a6
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -153,6 +153,7 @@ public class BundleUtil {
     * description.
     *
     * @throws BadParcelableException when the bundle does not meet the read-only requirements.
     * TODO: b/429180295 - Change to custom exception so callers are forced to handle it.
     */
    public static void sanitizeStateParams(
            @StateParams Bundle bundle) {
+12 −12
Original line number Diff line number Diff line
@@ -732,12 +732,12 @@ public class OnDeviceIntelligenceManagerService extends SystemService {
            public void updateProcessingState(
                    Bundle processingState,
                    IProcessingUpdateStatusCallback callback) {
              sanitizeStateParams(processingState);
              callbackExecutor.execute(() -> {
                    AndroidFuture<Void> result = null;
                    try {
                        // Reserved for use by system-server.
                        processingState.remove(KEY_DEVICE_CONFIG_UPDATE);
                        sanitizeStateParams(processingState);
                        ensureRemoteInferenceServiceInitialized();
                        result = mRemoteInferenceService.post(
                                service -> service.updateProcessingState(