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

Commit ca4a8581 authored by Alex Kershaw's avatar Alex Kershaw
Browse files

Ensure that we always log updating from file.

If an exception was thrown by one of the methods, we were not logging
the event, which caused the CTS test to fail.

In particular, this happened on non-AB devices, such as the emulator.

Bug: 127268862
Change-Id: I8f853d5e0a8e810a570562071fb73266fee3b696
Test: atest CtsDevicePolicyManagerTestCases:com.android.cts.devicepolicy.DeviceOwnerTest#testInstallUpdateLogged
parent b67994ab
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -14085,6 +14085,11 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
    @Override
    public void installUpdateFromFile(ComponentName admin,
            ParcelFileDescriptor updateFileDescriptor, StartInstallingUpdateCallback callback) {
        DevicePolicyEventLogger
                .createEvent(DevicePolicyEnums.INSTALL_SYSTEM_UPDATE)
                .setAdmin(admin)
                .setBoolean(isDeviceAB())
                .write();
        enforceDeviceOwner(admin);
        final long id = mInjector.binderClearCallingIdentity();
        try {
@@ -14097,11 +14102,6 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
                        mContext, updateFileDescriptor, callback, mInjector, mConstants);
            }
            updateInstaller.startInstallUpdate();
            DevicePolicyEventLogger
                    .createEvent(DevicePolicyEnums.INSTALL_SYSTEM_UPDATE)
                    .setAdmin(admin)
                    .setBoolean(isDeviceAB())
                    .write();
        } finally {
            mInjector.binderRestoreCallingIdentity(id);
        }